Files
fizzy/app/views/cards/show.html.erb
T
Mike Dalessio 248fc5d3e7 Fix back navigation from filter views to cards (#2725)
* test: update sign_in_as system test helper to be more generic

and support fixture users with more than one board

* test: backfill a test for the card "back link"

when coming from a board filter page

* Fix back navigation to filter views from cards

When navigating from a filter view to a card, the back link now shows
the filter's label and navigates back to the filter URL instead of the
card's board.

The turbo-navigation Stimulus controller stores the page title alongside
the referrer URL in sessionStorage. On the card show page, a
referrerBackLink target rewrites the back link's href and label from the
stored values. This is scoped only to the card show page to avoid
navigation loops in multi-level deep pages.

* Add referrer allowlist to prevent stale referrer rewrites

The back link is only rewritten when the stored referrer's path matches
an allowlist of paths passed via prefer_referrer. This prevents stale
referrers from unrelated pages (e.g., settings) from overriding the
card's back link.

* Move back link navigation tests to dedicated system test file

Extract back link tests from smoke_test.rb into their own file since
they test specific JavaScript behavior that needs regression coverage.
Move sign_in_as helper to ApplicationSystemTestCase for reuse.

* Move markdown paste tests to dedicated system test file
2026-03-18 17:03:13 -04:00

27 lines
809 B
Plaintext

<% @page_title = @card.title %>
<% @header_class = "header--card" %>
<% content_for :head do %>
<%= card_social_tags(@card) %>
<% end %>
<% content_for :header do %>
<div class="header__actions header__actions--start">
<%= link_back_to_board @card.board, prefer_referrer: [ cards_path, board_path(@card.board) ] %>
</div>
<% end %>
<%= turbo_stream_from @card %>
<%= turbo_stream_from @card, :activity %>
<div data-controller="beacon lightbox" data-beacon-url-value="<%= card_reading_path(@card) %>">
<%= render "cards/container", card: @card %>
<%= render "cards/messages", card: @card %>
<%= render "layouts/lightbox" do %>
<%= button_to_remove_card_image(@card) if @card.image.attached? %>
<% end %>
</div>
<%= bridged_share_url_button(bridge_share_card_description(@card)) %>