mirror of
https://github.com/we-promise/sure.git
synced 2026-05-27 22:44:55 +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>
114 lines
5.9 KiB
Plaintext
114 lines
5.9 KiB
Plaintext
<%# locals: (account:, return_to: nil) %>
|
|
|
|
<% is_default = Current.user&.default_account_id == account.id %>
|
|
|
|
<%= turbo_frame_tag dom_id(account) do %>
|
|
<div class="relative p-4 flex items-center justify-between gap-3 group/account hover:bg-surface-hover">
|
|
<div class="flex items-center gap-3">
|
|
<%= render "accounts/logo", account: account, size: "md" %>
|
|
|
|
<div>
|
|
<% if account.pending_deletion? %>
|
|
<p class="text-sm font-medium text-primary">
|
|
<span>
|
|
<%= account.name %>
|
|
</span>
|
|
<span class="text-red-500 animate-pulse">
|
|
(deletion in progress...)
|
|
</span>
|
|
</p>
|
|
<% else %>
|
|
<div class="flex items-center gap-1.5">
|
|
<%= link_to account.name, account, class: [(account.active? ? "text-primary" : "text-subdued"), "text-sm font-medium hover:underline"], data: { turbo_frame: "_top" } %>
|
|
|
|
<% if account.shared? %>
|
|
<%= icon("users", class: "w-3.5 h-3.5 text-secondary", title: account.owned_by?(Current.user) ? nil : account.owner&.display_name) %>
|
|
<% end %>
|
|
|
|
<% if account.institution_name.present? %>
|
|
<span class="hidden sm:inline text-secondary">• <%= account.institution_name %></span>
|
|
<% end %>
|
|
</div>
|
|
<% if account.long_subtype_label %>
|
|
<p class="text-sm text-secondary truncate"><%= account.long_subtype_label %></p>
|
|
<% end %>
|
|
<% if account.supports_default? && is_default %>
|
|
<p class="text-xs text-secondary opacity-50"><%= t("accounts.account.default_label") %></p>
|
|
<% end %>
|
|
<% if account.institution_name.present? %>
|
|
<p class="sm:hidden text-sm text-secondary truncate"><%= account.institution_name %></p>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center gap-4">
|
|
<% if account.draft? %>
|
|
<!-- Balance hidden for draft accounts -->
|
|
<% elsif account.syncing? %>
|
|
<div class="w-16 h-6 bg-loader rounded-full animate-pulse"></div>
|
|
<% else %>
|
|
<p class="text-sm font-medium privacy-sensitive <%= account.active? ? "text-primary" : "text-subdued" %>">
|
|
<%= format_money account.balance_money %>
|
|
</p>
|
|
<% end %>
|
|
|
|
<% if account.draft? %>
|
|
<%= render DS::Link.new(
|
|
text: t(".complete_setup"),
|
|
href: edit_account_path(account, return_to: return_to),
|
|
variant: :outline,
|
|
frame: :modal
|
|
) %>
|
|
<% elsif !account.pending_deletion? %>
|
|
<% permission = account.permission_for(Current.user) %>
|
|
<%= render DS::Menu.new(icon_vertical: true, mobile_fullwidth: false, max_width: "280px") do |menu| %>
|
|
<% if permission.in?([ :owner, :full_control ]) %>
|
|
<% menu.with_item(variant: "link", text: t("accounts.account.edit"), href: edit_account_path(account, return_to: return_to), icon: "pencil-line", data: { turbo_frame: :modal }) %>
|
|
<% end %>
|
|
<% menu.with_item(variant: "link", text: t("accounts.account.sharing"), href: account_sharing_path(account), icon: "users", data: { turbo_frame: :modal }) %>
|
|
|
|
<% if Current.user&.admin? %>
|
|
<% if !account.linked? && %w[Depository CreditCard Investment Crypto].include?(account.accountable_type) %>
|
|
<% menu.with_item(variant: "link", text: t("accounts.account.link_provider"), href: select_provider_account_path(account), icon: "link", data: { turbo_frame: :modal }) %>
|
|
<% elsif account.linked? %>
|
|
<%# Same-provider relink (e.g., card-replacement fraud). Only surfaced for
|
|
SimpleFIN-linked accounts today; other providers can be added later. %>
|
|
<% if account.linked_to?("SimplefinAccount") %>
|
|
<% menu.with_item(
|
|
variant: "link",
|
|
text: t("accounts.account.change_simplefin_account"),
|
|
href: select_existing_account_simplefin_items_path(account_id: account.id),
|
|
icon: "arrow-left-right",
|
|
data: { turbo_frame: :modal }
|
|
) %>
|
|
<% end %>
|
|
<% menu.with_item(variant: "link", text: t("accounts.account.unlink_provider"), href: confirm_unlink_account_path(account), icon: "unlink", data: { turbo_frame: :modal }) %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if permission.in?([ :owner, :full_control ]) %>
|
|
<% menu.with_item(variant: "divider") %>
|
|
|
|
<% if account.active? %>
|
|
<% menu.with_item(variant: "button", text: t("accounts.account.disable"), href: toggle_active_account_path(account), method: :patch, icon: "toggle-right", data: { turbo_frame: :_top }) %>
|
|
<% elsif account.disabled? %>
|
|
<% menu.with_item(variant: "button", text: t("accounts.account.enable"), href: toggle_active_account_path(account), method: :patch, icon: "toggle-left", data: { turbo_frame: :_top }) %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if is_default %>
|
|
<% menu.with_item(variant: "button", text: t("accounts.account.remove_default"), href: remove_default_account_path(account), method: :patch, icon: "star-off", data: { turbo_frame: :_top }) %>
|
|
<% elsif account.eligible_for_transaction_default? %>
|
|
<% menu.with_item(variant: "button", text: t("accounts.account.set_default"), href: set_default_account_path(account), method: :patch, icon: "star", data: { turbo_frame: :_top }) %>
|
|
<% end %>
|
|
|
|
<% if account.owned_by?(Current.user) && !account.linked? %>
|
|
<% menu.with_item(variant: "divider") %>
|
|
<% menu.with_item(variant: "button", text: t("accounts.account.delete"), href: account_path(account), method: :delete, icon: "trash-2", confirm: CustomConfirm.for_resource_deletion("account", high_severity: true), data: { turbo_frame: :_top }) %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|