Extract explaining helper method

This commit is contained in:
David Heinemeier Hansson
2025-10-29 18:11:43 +01:00
parent 01beb8517a
commit e59f756c01
2 changed files with 7 additions and 3 deletions
+6
View File
@@ -1,4 +1,10 @@
module CollectionsHelper
def hotkeyed_link_to_collection(collection, &)
link_to collection, class: "header__title btn borderless txt-large",
style: "--btn-padding: 0.25ch 1ch 0.25ch 0.75ch; view-transistion-name: card-collection-title;",
data: { controller: "hotkey", action: "keydown.esc@document->hotkey#click click->turbo-navigation#backIfSamePath" }, &
end
def referenced_collections_from(records)
Current.user.collections.where id: records.pluck(:collection_id).uniq
end
+1 -3
View File
@@ -11,9 +11,7 @@
<% content_for :header do %>
<%= render "filters/menu" %>
<%= link_to collection_url(@card.collection), class: "header__title btn borderless txt-large",
style: "--btn-padding: 0.25ch 1ch 0.25ch 0.75ch; view-transistion-name: card-collection-title;",
data: { controller: "hotkey", action: "keydown.esc@document->hotkey#click click->turbo-navigation#backIfSamePath" } do %>
<%= hotkeyed_link_to_collection(@card.collection) do %>
<span class="overflow-ellipsis">
&larr;
<strong class="font-black"><%= @card.collection.name %></strong>