Refresh the cards perma dynamically with page refreshes

This commit is contained in:
Jorge Manrubia
2025-11-03 13:04:21 +01:00
parent 5f7feed6c4
commit 37ce2c98d1
8 changed files with 18 additions and 10 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
class Card < ApplicationRecord
include Assignable, Attachments, Closeable, Colored, Entropic, Eventable,
Golden, Mentions, Multistep, Pinnable, Postponable, Promptable, Readable,
Searchable, Stallable, Statuses, Taggable, Triageable, Watchable
include Assignable, Attachments, Broadcastable, Closeable, Colored, Entropic,
Eventable, Golden, Mentions, Multistep, Pinnable, Postponable, Promptable,
Readable, Searchable, Stallable, Statuses, Taggable, Triageable, Watchable
belongs_to :collection, touch: true
belongs_to :creator, class_name: "User", default: -> { Current.user }
+7
View File
@@ -0,0 +1,7 @@
module Card::Broadcastable
extend ActiveSupport::Concern
included do
broadcasts_refreshes
end
end
@@ -9,7 +9,7 @@
<span class="for-screen-reader">Assign</span>
</button>
<dialog class="popup panel flex-column align-start gap-half fill-white shadow" data-dialog-target="dialog">
<dialog class="popup panel flex-column align-start gap-half fill-white shadow" data-dialog-target="dialog" data-action="turbo:before-morph-attribute->dialog#preventCloseOnMorphing turbo:submit-end->dialog#close">
<%= yield %>
</dialog>
</div>
@@ -1,3 +1,3 @@
<%= render "cards/display/common/assignees", card: card do %>
<%= turbo_frame_tag card, :assignment, src: new_card_assignment_path(card) %>
<%= turbo_frame_tag card, :assignment, src: new_card_assignment_path(card), refresh: "morph" %>
<% end %>
@@ -6,8 +6,8 @@
<span class="for-screen-reader">Choose a collection for this card</span>
</button>
<dialog class="popup panel flex-column align-start gap-half fill-white shadow margin-block-double" data-dialog-target="dialog">
<%= turbo_frame_tag "collection_picker", src: edit_card_collection_path(card), target: "_top" %>
<dialog class="popup panel flex-column align-start gap-half fill-white shadow margin-block-double" data-dialog-target="dialog" data-action="turbo:before-morph-attribute->dialog#preventCloseOnMorphing turbo:submit-end->dialog#close">
<%= turbo_frame_tag "collection_picker", src: edit_card_collection_path(card), target: "_top", refresh: "morph" %>
</dialog>
</div>
<% end %>
+2 -2
View File
@@ -5,8 +5,8 @@
<span class="for-screen-reader">Add a tag</span>
</button>
<dialog class="popup panel flex-column align-start justify-start fill-white shadow txt-small" data-dialog-target="dialog">
<%= turbo_frame_tag card, :tagging, src: new_card_tagging_path(card) %>
<dialog class="popup panel flex-column align-start justify-start fill-white shadow txt-small" data-dialog-target="dialog" data-action="turbo:before-morph-attribute->dialog#preventCloseOnMorphing turbo:submit-end->dialog#close">
<%= turbo_frame_tag card, :tagging, src: new_card_tagging_path(card), refresh: "morph" %>
</dialog>
</div>
+1
View File
@@ -11,6 +11,7 @@
</div>
<% end %>
<%= turbo_stream_from @card %>
<%= turbo_stream_from @card, :activity %>
<div data-controller="beacon lightbox" data-beacon-url-value="<%= card_reading_path(@card) %>">
+1 -1
View File
@@ -1 +1 @@
<%= turbo_frame_tag dom_id(card, :columns), src: edit_card_column_path(card), target: "_top" %>
<%= turbo_frame_tag dom_id(card, :columns), src: edit_card_column_path(card), target: "_top", refresh: "morph" %>