mirror of
https://github.com/we-promise/sure.git
synced 2026-05-30 07:49:01 +00:00
Direct nav to /goals/new used to render the index page with an empty modal frame because the entire template was wrapped in DS::Dialog. The URL was effectively un-shareable. Branch on turbo_frame_request? — Turbo Frame requests still render the DS::Dialog wrapper (the existing in-modal flow on the index page keeps working). Non-frame requests render a standalone page-level header (h1 + subtitle + icon) followed by the form_stepper partial. Same Stimulus controller, same data-goal-stepper-modal-subtitle selector, so the stepper's subtitle update path works identically. Controller sets @breadcrumbs so the standalone variant gets the Home > Goals > New goal trail. Verified both paths via Playwright: direct GET renders standalone form with h1 "New goal" + no dialog; click-from-index opens the DS::Dialog with the stepper inside.
35 lines
1.5 KiB
Plaintext
35 lines
1.5 KiB
Plaintext
<% if turbo_frame_request? %>
|
|
<%= render DS::Dialog.new(width: "lg") do |dialog| %>
|
|
<% dialog.with_header(custom_header: true) do %>
|
|
<div class="flex items-start justify-between gap-3">
|
|
<div class="flex items-start gap-3">
|
|
<%= render DS::FilledIcon.new(variant: :container, icon: "target", size: "md", rounded: true) %>
|
|
<div>
|
|
<h2 class="text-base font-medium text-primary"><%= t(".heading") %></h2>
|
|
<p class="text-sm text-secondary mt-0.5" data-goal-stepper-modal-subtitle>
|
|
<%= t(".step1_subtitle") %>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<%= render DS::Button.new(variant: "icon", icon: "x", title: t("common.close"), aria_label: t("common.close"), data: { action: "DS--dialog#close" }) %>
|
|
</div>
|
|
<% end %>
|
|
<% dialog.with_body do %>
|
|
<%= render "form_stepper", goal: @goal, linkable_accounts: @linkable_accounts %>
|
|
<% end %>
|
|
<% end %>
|
|
<% else %>
|
|
<div class="max-w-2xl mx-auto py-8 px-4">
|
|
<header class="mb-6 flex items-start gap-3">
|
|
<%= render DS::FilledIcon.new(variant: :container, icon: "target", size: "md", rounded: true) %>
|
|
<div>
|
|
<h1 class="text-xl font-medium text-primary"><%= t(".heading") %></h1>
|
|
<p class="text-sm text-secondary mt-0.5" data-goal-stepper-modal-subtitle>
|
|
<%= t(".step1_subtitle") %>
|
|
</p>
|
|
</div>
|
|
</header>
|
|
<%= render "form_stepper", goal: @goal, linkable_accounts: @linkable_accounts %>
|
|
</div>
|
|
<% end %>
|