Refresh activity-related bits in the card perma dynamically:
- Remove entropy bubble - Refresh the auto close notice https://app.box-car.com/5986089/cards/2683
This commit is contained in:
@@ -19,6 +19,7 @@ module Card::Eventable
|
||||
def touch_last_active_at
|
||||
# Not using touch so that we can detect attribute change on callbacks
|
||||
update!(last_active_at: Time.current)
|
||||
broadcast_activity
|
||||
end
|
||||
|
||||
private
|
||||
@@ -35,4 +36,8 @@ module Card::Eventable
|
||||
def create_system_comment_for(event)
|
||||
SystemCommenter.new(self, event).comment
|
||||
end
|
||||
|
||||
def broadcast_activity
|
||||
broadcast_render_later_to self, :activity, partial: "card/display/refresh_activity", locals: { card: self }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<%= turbo_stream.remove dom_id(card, "bubble") %>
|
||||
<%= turbo_stream.replace dom_id(card, :card_closure_toggle) do %>
|
||||
<%= render "cards/container/closure", card: card %>
|
||||
<% end %>
|
||||
@@ -10,10 +10,13 @@
|
||||
<%= button_to card_closure_path(card), class: "btn borderless" do %>
|
||||
<span class="overflow-ellipsis">Mark as Done</span>
|
||||
<% end %>
|
||||
<% if card.entropic? && card.open? %>
|
||||
<div class="card-perma__closure-message">
|
||||
Closes as “Not Now” <%= local_datetime_tag(card.entropy.auto_clean_at, style: :indays) -%> if there’s no activity.
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div id="<%= dom_id(card, :closure_notice) %>">
|
||||
<% if card.entropic? && card.open? %>
|
||||
<div class="card-perma__closure-message">
|
||||
Closes as "Not Now" <%= local_datetime_tag(card.entropy.auto_clean_at, style: :indays) -%> if there's no activity.
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<%= tag.div hidden: true, class: "bubble",
|
||||
<%= tag.div \
|
||||
id: dom_id(card, "bubble"),
|
||||
hidden: true,
|
||||
class: "bubble",
|
||||
data: {
|
||||
controller: "bubble",
|
||||
action: "turbo:morph-element->bubble#update",
|
||||
|
||||
@@ -11,7 +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) %>">
|
||||
<%= render "cards/container", card: @card %>
|
||||
|
||||
Reference in New Issue
Block a user