Did need to separate them out for the broadcast

This commit is contained in:
David Heinemeier Hansson
2025-04-11 18:19:33 +02:00
parent 5fa8007397
commit 06a636bd8d
3 changed files with 6 additions and 6 deletions
@@ -34,7 +34,7 @@ class Cards::Comments::ReactionsController < ApplicationController
def broadcast_create(reaction)
reaction.broadcast_append_to @card,
target: "reactions_comment_#{@comment.id}", partial: "cards/comments/reactions/reaction", locals: { comment: @comment }
target: [ @comment, :reactions ], partial: "cards/comments/reactions/reaction", locals: { comment: @comment }
end
def broadcast_remove(reaction)
@@ -1,7 +1,7 @@
<%= turbo_frame_tag comment, :reactions do %>
<%= turbo_frame_tag comment, :reacting do %>
<div class="reactions flex flex-wrap align-center gap full-width">
<div class="flex-inline flex-wrap gap">
<%= render partial: "cards/comments/reactions/reaction", collection: comment.reactions.ordered %>
<div id="<%= dom_id(comment, :reactions) %>" class="flex-inline flex-wrap gap">
<%= render partial: "cards/comments/reactions/reaction", collection: comment.reactions.includes(:reacter).ordered %>
</div>
<%= turbo_frame_tag comment, :new_reaction do %>
@@ -2,7 +2,7 @@
<%= form_with url: card_comment_reactions_path(@comment.card, @comment),
class: "reaction reaction__form flex-inline postion--relative max-width align-center fill-white gap expanded",
html: { aria: { label: "New reaction" } },
data: { controller: "form", turbo_frame: dom_id(@comment, :reactions), action: "keydown.esc->form#cancel" } do |form| %>
data: { controller: "form", turbo_frame: dom_id(@comment, :reacting), action: "keydown.esc->form#cancel" } do |form| %>
<label class="reaction__form-label flex gap" style="--column-gap: 0.7ch;">
<figure class="reaction__avatar margin-none flex-item-no-shrink">
<%= avatar_tag Current.user %>
@@ -18,7 +18,7 @@
<% end %>
<%= link_to card_comment_reactions_path(@comment.card, @comment), role: "button",
data: { turbo_frame: dom_id(@comment, :reactions), form_target: "cancel" }, class: "btn btn--negative" do %>
data: { turbo_frame: dom_id(@comment, :reacting), form_target: "cancel" }, class: "btn btn--negative" do %>
<%= icon_tag "minus" %> <span class="for-screen-reader">Cancel</span>
<% end %>
<% end %>