Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
2.4 KB
Raw Blame
<% if Current.user.admin? %>
  <% if @market_data_refreshable %>
    <% warning = t("settings.hostings.show.clear_cache_warning") %>
    <% confirm_body = t("settings.hostings.show.confirm_clear_cache.body") %>
  <% else %>
    <% warning = t("settings.hostings.show.clear_cache_warning_without_provider") %>
    <% confirm_body = t("settings.hostings.show.confirm_clear_cache.body_without_provider") %>
  <% end %>
  <div class="space-y-4">
    <div class="flex flex-col md:flex-row md:items-center md:justify-between gap-4">
      <div class="w-full md:w-2/3">
        <h3 class="font-medium text-primary"><%= t("settings.hostings.show.clear_cache") %></h3>
        <p class="text-secondary text-sm"><%= warning %></p>
      </div>
      <%=
            button_to t("settings.hostings.show.clear_cache"), clear_cache_settings_hosting_path, method: :delete,
              class: "w-full md:w-auto bg-yellow-600 text-inverse text-sm font-medium rounded-lg px-4 py-2",
              data: { turbo_confirm: {
                title: t("settings.hostings.show.confirm_clear_cache.title"),
                body: confirm_body,
                accept: t("settings.hostings.show.clear_cache"),
                acceptClass: "w-full bg-yellow-600 text-inverse rounded-xl text-center p-[10px] border mb-2"
              }}
      %>
    </div>

    <% if Current.user.super_admin? %>
      <div class="flex flex-col md:flex-row md:items-center md:justify-between gap-4">
        <div class="w-full md:w-2/3">
          <h3 class="font-medium text-primary"><%= t("settings.hostings.show.reset_market_data") %></h3>
          <p class="text-secondary text-sm"><%= t("settings.hostings.show.reset_market_data_warning") %></p>
        </div>
        <%= render DS::Button.new(
              text: t("settings.hostings.show.reset_market_data"),
              variant: :destructive,
              href: reset_market_data_settings_hosting_path,
              method: :delete,
              class: "w-full md:w-auto",
              confirm: CustomConfirm.new(
                destructive: true,
                high_severity: true,
                title: t("settings.hostings.show.confirm_reset_market_data.title"),
                body: t("settings.hostings.show.confirm_reset_market_data.body"),
                btn_text: t("settings.hostings.show.reset_market_data")
              )
            ) %>
      </div>
    <% end %>
  </div>
<% end %>