Files
sure/app/views/settings/_section.html.erb
LPW 8c9764f1ad Unify provider and account card UI and move setup actions to menus (#755)
* feat: add auto-open functionality for collapsible sections and streamline unlinked account handling

- Introduce `auto-open` Stimulus controller to auto-expand <details> elements based on URL params.
- Update all settings sections and panels to support the new `auto_open_param` for seamless navigation.
- Improve unlinked account logic for Coinbase, SimpleFIN, and SnapTrade, ensuring consistent and optimized handling.
- Refactor sync warnings and badges for better readability and user experience.
- Extend localization for additional menu items, warnings, and setup prompts.

* fix: improve error handling and safe HTML usage in Coinbase and settings components

- Log warning for unhandled exceptions in Coinbase unlinked account count fallback.
- Escape `auto_open_param` in settings section for safe HTML injection.
- Clean up URL params in `auto-open` controller after auto-expansion.

---------

Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
2026-01-24 01:11:56 +01:00

34 lines
1.3 KiB
Plaintext

<%# locals: (title:, subtitle: nil, content:, collapsible: false, open: true, auto_open_param: nil) %>
<% if collapsible %>
<details <%= "open" if open %>
class="group bg-container shadow-border-xs rounded-xl p-4"
<%= "data-controller=\"auto-open\" data-auto-open-param-value=\"#{h(auto_open_param)}\"".html_safe if auto_open_param.present? %>>
<summary class="flex items-center justify-between gap-2 cursor-pointer rounded-lg list-none [&::-webkit-details-marker]:hidden">
<div class="flex items-center gap-2">
<%= icon "chevron-right", class: "text-secondary group-open:transform group-open:rotate-90 transition-transform" %>
<div>
<h2 class="text-lg font-medium text-primary"><%= title %></h2>
<% if subtitle.present? %>
<p class="text-secondary text-sm"><%= subtitle %></p>
<% end %>
</div>
</div>
</summary>
<div class="space-y-4 mt-4">
<%= content %>
</div>
</details>
<% else %>
<section class="bg-container shadow-border-xs rounded-xl p-4 space-y-4">
<div>
<h2 class="text-lg font-medium text-primary"><%= title %></h2>
<% if subtitle.present? %>
<p class="text-secondary text-sm mt-1"><%= subtitle %></p>
<% end %>
</div>
<div class="space-y-4">
<%= content %>
</div>
</section>
<% end %>