diff --git a/AGENTS.md b/AGENTS.md index db37359ab7..07cb10d16c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -426,7 +426,7 @@ end - `print_options` — Print options toggle for analytics - `reminder_preview` — Live-preview the reminder email as the admin composes it on the bulk-reminder page: custom message, subject, and the event-details box toggle (announced to screen readers) - `remote_select` — AJAX-powered select dropdown -- `reveal_section` — Expand a collapsible section and scroll to it when loaded via matching URL hash +- `reveal_section` — Expand a collapsible section and scroll to it when loaded via matching URL hash or `scroll_to` query parameter - `rhino_source` — Rich text editor integration - `scholarship_preview` — Live-preview the scholarship's allocated amount as the edit form changes - `scroll_to_top` — Scrolls the window to the top on connect (used by the duplicate-person warning so it comes into view on create) diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 407ac5dcf1..7d816b1713 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -392,7 +392,7 @@ def feature_recipient_shoutout # accurate "locked" warning instead of the generic prompt. (#1944) locked = @event.event_registrations.find_by(id: params[:registration_id])&.editing_locked? message = locked ? "That registrant was transferred out — their registration is locked. Undo the transfer to feature them." : "Choose a recipient to feature." - redirect_to recipients_event_path(@event), alert: message and return + redirect_to recipients_event_path(@event), alert: message, status: :see_other and return end authorize! registration, to: :update? @@ -401,7 +401,7 @@ def feature_recipient_shoutout if registrant.shoutout_text.blank? && (bio = shoutout_bio_from_profile(registrant)) registrant.update!(shoutout_text: bio) end - redirect_to edit_event_registration_path(registration, return_to: "recipients", anchor: "shout-out"), + redirect_to edit_event_registration_path(registration, return_to: "recipients", scroll_to: "shout-out"), notice: "Featured on the recipients page — review their shout-out text below.", status: :see_other end diff --git a/app/frontend/javascript/controllers/reveal_section_controller.js b/app/frontend/javascript/controllers/reveal_section_controller.js index e8865a41cd..cabd13c9b4 100644 --- a/app/frontend/javascript/controllers/reveal_section_controller.js +++ b/app/frontend/javascript/controllers/reveal_section_controller.js @@ -1,8 +1,8 @@ import { Controller } from "@hotwired/stimulus" // Expands a collapsible section and scrolls it into view when the page loads -// with a matching URL hash — e.g. when linked from another page so the user -// lands on the section already open rather than collapsed or scrolled past. +// with a matching URL hash or scroll_to query parameter. The query parameter +// carries the target through Turbo form redirects, which drop URL fragments. // //