Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
2.5 KB
Raw Blame
<div class="space-y-4">
  <div>
    <h2 class="font-medium mb-1"><%= t(".title") %></h2>
    <% if ENV["BRAND_FETCH_CLIENT_ID"].present? %>
      <p class="text-sm text-secondary"><%= t(".env_configured_message") %></p>
    <% else %>
      <div class="text-secondary text-sm mb-4">
        <span><%= t(".description") %></span>
        <details class="inline">
          <summary class="cursor-pointer font-medium text-secondary underline inline"> <%= t(".show_details") %></summary>
          <ol class="text-sm text-secondary mt-2 list-decimal ml-6 space-y-2">
            <li>
              <%= t(".setup_step_1_html") %>
            </li>
            <li>
              <%= t(".setup_step_2_html") %>
            </li>
            <li>
              <%= t(".setup_step_3") %>
            </li>
          </ol>
        </details>
      </div>
    <% end %>
  </div>

  <%= styled_form_with model: Setting.new,
                       url: settings_hosting_path,
                       method: :patch,
                       data: {
                         controller: "auto-submit-form",
                         "auto-submit-form-trigger-event-value": "blur"
                       } do |form| %>
    <%= form.text_field :brand_fetch_client_id,
                        label: t(".label"),
                        type: "password",
                        autocomplete: "new-password",
                        placeholder: t(".placeholder"),
                        value: ENV.fetch("BRAND_FETCH_CLIENT_ID", Setting.brand_fetch_client_id),
                        disabled: ENV["BRAND_FETCH_CLIENT_ID"].present?,
                        data: { "auto-submit-form-target": "auto" } %>
  <% end %>

  <div class="flex items-center justify-between mt-4">
    <div class="space-y-1">
      <p class="text-sm"><%= t(".high_res_label") %></p>
      <p class="text-secondary text-sm"><%= t(".high_res_description") %></p>
    </div>

    <%= styled_form_with model: Setting.new,
                         url: settings_hosting_path,
                         method: :patch,
                         data: { controller: "auto-submit-form", auto_submit_form_trigger_event_value: "change" } do |form| %>
      <%= form.toggle :brand_fetch_high_res_logos,
                      checked: ENV["BRAND_FETCH_HIGH_RES_LOGOS"].present? ? ENV["BRAND_FETCH_HIGH_RES_LOGOS"] == "true" : Setting.brand_fetch_high_res_logos,
                      disabled: ENV["BRAND_FETCH_HIGH_RES_LOGOS"].present?,
                      data: { auto_submit_form_target: "auto" } %>
    <% end %>
  </div>
</div>