Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
1.8 KB
Raw Blame
<div class="space-y-4">
  <% if @tinkoff_invest_moex_only %>
    <%= render DS::Alert.new(message: t(".moex_only_notice"), variant: :info) %>
  <% end %>
  <div>
    <h2 class="font-medium mb-1"><%= t(".title") %></h2>
    <% if ENV["TINKOFF_INVEST_API_KEY"].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>
        <%= render DS::Disclosure.new(variant: :inline) do |disclosure| %>
          <% disclosure.with_summary_content do %>
            <span class="font-medium text-secondary underline"><%= t(".show_details") %></span>
          <% end %>
          <ol class="text-sm text-secondary mt-2 list-decimal ml-6 space-y-2">
            <li><%= t(".step_1") %></li>
            <li><%= t(".step_2") %></li>
            <li><%= t(".step_3") %></li>
          </ol>
        <% end %>
      </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| %>
    <% has_key = ENV["TINKOFF_INVEST_API_KEY"].present? || Setting.tinkoff_invest_api_key.present? %>
    <%= form.text_field :tinkoff_invest_api_key,
                        label: t(".label"),
                        type: "password",
                        placeholder: t(".placeholder"),
                        value: has_key ? "********" : "",
                        disabled: ENV["TINKOFF_INVEST_API_KEY"].present?,
                        data: { "auto-submit-form-target": "auto" } %>
  <% end %>
</div>