Merge pull request #416 from basecamp/replace-with-morph

Use morphing in the stream replace the card container
This commit is contained in:
David Heinemeier Hansson
2025-04-21 15:40:28 +02:00
committed by GitHub
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -15,6 +15,6 @@ module CardScoped
end
def render_card_replacement
render turbo_stream: turbo_stream.replace([ @card, :card_container ], partial: "cards/container", locals: { card: @card.reload })
render turbo_stream: turbo_stream.replace([ @card, :card_container ], partial: "cards/container", method: :morph, locals: { card: @card.reload })
end
end
+2 -3
View File
@@ -32,10 +32,9 @@
</div>
<% if card.published? %>
<%# FIXME: Let's move this aside outside of the card container section so these frames don't reload/flicker when card is replaced %>
<aside class="card-perma__actions card-perma__actions--right" role="toolbar">
<%= turbo_frame_tag card, :watch, src: card_watch_path(card) %>
<%= turbo_frame_tag card, :pin, src: card_pin_path(card) %>
<%= turbo_frame_tag card, :watch, src: card_watch_path(card), data: { turbo_permanent: true } %>
<%= turbo_frame_tag card, :pin, src: card_pin_path(card), data: { turbo_permanent: true } %>
</aside>
<%= render "cards/container/closure", card: card %>