mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-10 16:05:22 +02:00
* Prevent account deletions when account is linked to a Plaid Item * Only guard deletions in UI and controller, not at model level
27 lines
898 B
Text
27 lines
898 B
Text
<%# locals: (account:) %>
|
|
|
|
<%= render MenuComponent.new(testid: "account-menu") do |menu| %>
|
|
<% menu.with_item(variant: "link", text: "Edit", href: edit_account_path(account), icon: "pencil-line", data: { turbo_frame: :modal }) %>
|
|
|
|
<% unless account.crypto? %>
|
|
<% menu.with_item(
|
|
variant: "link",
|
|
text: "Import transactions",
|
|
href: imports_path({ import: { type: account.investment? ? "TradeImport" : "TransactionImport", account_id: account.id } }),
|
|
icon: "download",
|
|
data: { turbo_frame: :_top }
|
|
) %>
|
|
<% end %>
|
|
|
|
<% unless account.linked? %>
|
|
<% menu.with_item(
|
|
variant: "button",
|
|
text: "Delete account",
|
|
href: account_path(account),
|
|
method: :delete,
|
|
icon: "trash-2",
|
|
confirm: CustomConfirm.for_resource_deletion("account", high_severity: true),
|
|
data: { turbo_frame: :_top }
|
|
) %>
|
|
<% end %>
|
|
<% end %>
|