Files
fizzy/app/controllers/concerns/card_scoped.rb
T
Jorge Manrubia 3e1a2bcc7e Use morphing to replace the card and exclude turbo frames from being replaced
Reconnecting the frames result in a visible flickering.

This also prevents flickering in the avatars when replacing the card container.
2025-04-21 09:24:57 +02:00

21 lines
485 B
Ruby

module CardScoped
extend ActiveSupport::Concern
included do
before_action :set_card, :set_collection
end
private
def set_card
@card = Current.user.accessible_cards.find(params[:card_id])
end
def set_collection
@collection = @card.collection
end
def render_card_replacement
render turbo_stream: turbo_stream.replace([ @card, :card_container ], partial: "cards/container", method: :morph, locals: { card: @card.reload })
end
end