mirror of
https://github.com/we-promise/sure.git
synced 2026-05-25 13:34:58 +00:00
* Extract hardcoded strings to i18n
Replace numerous hardcoded English strings with I18n lookups (t / I18n.t) across controllers, views, helpers, and components, and convert model validation error messages to symbol keys. Added multiple locale files under config/locales for models and views. This centralizes user-facing notices/alerts, UI text, import/validation messages, and prepares the app for localization and easier translation maintenance.
* Update en.yml
* Update preview-cleanup.yml
* Revert "Update preview-cleanup.yml"
This reverts commit 1ba6d3c34c.
* test: align i18n assertions with translated messages
* Standardize balance error key and tweak locales
Replace SophtronAccount's :requires_balance error key with :no_balance and update related locale strings for sophtron, plaid, and simplefin accounts to use the new key and clearer copy. Also switch the QIF upload redirect notice to use a relative translation key (t('.qif_uploaded')), remove an unused SSO providers help line, and fix a trailing-newline/whitespace issue in the subscriptions locale. These changes standardize validation keys and improve translation consistency and messaging.
---------
Co-authored-by: KiloClaw <kiloclaw@openclaw.ai>
126 lines
6.3 KiB
Plaintext
126 lines
6.3 KiB
Plaintext
<%# locals: (import:) %>
|
|
|
|
<%= styled_form_with model: @import,
|
|
url: import_configuration_path(@import),
|
|
scope: :import,
|
|
method: :patch,
|
|
class: "space-y-4",
|
|
data: {
|
|
controller: "import",
|
|
import_csv_value: import.csv_rows.to_json,
|
|
import_amount_type_column_key_value: @import.entity_type_col_label
|
|
} do |form| %>
|
|
|
|
<%# Row Skip Configuration - must be first to configure before column mapping %>
|
|
<%= form.number_field :rows_to_skip,
|
|
{ label: t(".rows_to_skip_label", default: "Skip first n rows"), min: 0, step: 1, data: { action: "change->import#refreshForm" } } %>
|
|
|
|
<%# Date Configuration %>
|
|
<div class="flex items-center gap-4">
|
|
<%= form.select :date_col_label,
|
|
import.csv_headers,
|
|
{ label: t(".date_label"), prompt: t(".select_column") },
|
|
required: true %>
|
|
<%= form.select :date_format,
|
|
Family::DATE_FORMATS,
|
|
{ label: t(".date_format_label"), prompt: t(".select_format") },
|
|
required: true %>
|
|
</div>
|
|
|
|
<%# Amount Configuration %>
|
|
<div class="flex items-center gap-4">
|
|
<%= form.select :amount_col_label,
|
|
import.csv_headers,
|
|
{ label: t(".amount_label"), container_class: "w-2/5", prompt: t(".select_column") },
|
|
required: true %>
|
|
<%= form.select :currency_col_label,
|
|
import.csv_headers,
|
|
{ include_blank: t(".default"), label: t(".currency_label"), container_class: "w-1/5" } %>
|
|
<%= form.select :number_format,
|
|
Import::NUMBER_FORMATS.keys,
|
|
{ label: t(".format_label"), prompt: t(".select_format"), container_class: "w-2/5" },
|
|
required: true %>
|
|
</div>
|
|
|
|
<%# Amount Type Strategy %>
|
|
<%= form.select :amount_type_strategy,
|
|
Import::AMOUNT_TYPE_STRATEGIES.map { |strategy| [strategy.humanize, strategy] },
|
|
{ label: t(".amount_type_strategy_label"), prompt: t(".select_strategy") },
|
|
required: true,
|
|
data: {
|
|
action: "import#handleAmountTypeStrategyChange",
|
|
import_target: "amountTypeStrategySelect"
|
|
} %>
|
|
|
|
<%# Signed Amount Configuration %>
|
|
<%= tag.fieldset data: { import_target: "signedAmountFieldset" },
|
|
class: @import.amount_type_strategy == "signed_amount" ? "block" : "hidden" do %>
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-sm shrink-0 text-secondary">↪</span>
|
|
<%= form.select :signage_convention,
|
|
[[t(".incomes_are_positive"), "inflows_positive"], [t(".incomes_are_negative"), "inflows_negative"]],
|
|
{ label: t(".amount_type_label"), prompt: t(".select_convention") },
|
|
required: @import.amount_type_strategy == "signed_amount" %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%# Custom Column Configuration %>
|
|
<%= tag.fieldset data: { import_target: "customColumnFieldset" },
|
|
class: @import.amount_type_strategy == "custom_column" ? "block" : "hidden" do %>
|
|
<div class="space-y-2">
|
|
<div class="flex items-center gap-2 text-sm">
|
|
<span class="shrink-0 text-secondary">↪</span>
|
|
<span class="text-secondary"><%= t(".set") %></span>
|
|
<%= form.select :entity_type_col_label,
|
|
import.csv_headers,
|
|
{ prompt: t(".select_column"), container_class: "w-48 px-3 py-1.5 border border-secondary rounded-md" },
|
|
required: @import.amount_type_strategy == "custom_column",
|
|
data: { action: "import#handleAmountTypeChange" } %>
|
|
<span class="text-secondary"><%= t(".as_amount_type_column") %></span>
|
|
</div>
|
|
|
|
<div class="items-center gap-2 text-sm <%= @import.entity_type_col_label.nil? ? "hidden" : "flex" %>" data-import-target="amountTypeValue">
|
|
<span class="shrink-0 text-secondary">↪</span>
|
|
<span class="text-secondary"><%= t(".set") %></span>
|
|
<%= form.select :amount_type_identifier_value,
|
|
@import.selectable_amount_type_values,
|
|
{ prompt: t(".select_value"), container_class: "w-48 px-3 py-1.5 border border-secondary rounded-md" },
|
|
required: @import.amount_type_strategy == "custom_column",
|
|
data: { action: "import#handleAmountTypeIdentifierChange" } %>
|
|
<span class="text-secondary"><%= t(".as_identifier_value") %></span>
|
|
</div>
|
|
|
|
<div class="items-center gap-2 text-sm <%= @import.amount_type_identifier_value.nil? ? "hidden" : "flex" %>" data-import-target="amountTypeInflowValue">
|
|
<span class="shrink-0 text-secondary">↪</span>
|
|
<span class="text-secondary"><%= t(".treat_as_html", value: @import.amount_type_identifier_value) %></span>
|
|
<%= form.select :amount_type_inflow_value,
|
|
[[t(".income_inflow"), "inflows_positive"], [t(".expense_outflow"), "inflows_negative"]],
|
|
{ prompt: t(".select_type"), container_class: "w-48 px-3 py-1.5 border border-secondary rounded-md" },
|
|
required: @import.amount_type_strategy == "custom_column" %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%# Optional Fields %>
|
|
<% unless import.account.present? %>
|
|
<%= form.select :account_col_label,
|
|
import.csv_headers,
|
|
{ include_blank: t(".leave_empty"), label: t(".account_label") } %>
|
|
<% end %>
|
|
|
|
<%= form.select :name_col_label,
|
|
import.csv_headers,
|
|
{ include_blank: t(".leave_empty"), label: t(".name_label") } %>
|
|
<%= form.select :category_col_label,
|
|
import.csv_headers,
|
|
{ include_blank: t(".leave_empty"), label: t(".category_label") } %>
|
|
<%= form.select :tags_col_label,
|
|
import.csv_headers,
|
|
{ include_blank: t(".leave_empty"), label: t(".tags_label") } %>
|
|
<%= form.select :notes_col_label,
|
|
import.csv_headers,
|
|
{ include_blank: t(".leave_empty"), label: t(".notes_label") } %>
|
|
|
|
<%= form.submit t(".apply_configuration"), disabled: import.complete? %>
|
|
<% end %>
|