Avoid needing to pass an extra variable to the reactions partial
Thanks to inverse_of, there's no extra query getting the comment from the reaction.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
class: [ "txt-small", { "txt-medium": reaction.all_emoji? } ],
|
||||
data: { action: "click->reaction-delete#reveal keydown.enter->reaction-delete#reveal:prevent", reaction_delete_target: "content" } %>
|
||||
|
||||
<%= button_to card_comment_reaction_path(comment.card, comment, reaction),
|
||||
<%= button_to card_comment_reaction_path(reaction.comment.card, reaction.comment, reaction),
|
||||
method: :delete,
|
||||
class: "btn btn--negative flex-item-justify-end reaction__delete",
|
||||
data: { action: "reaction-delete#perform", reaction_delete_target: "button" } do %>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<%= turbo_frame_tag comment, :reactions 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, locals: { comment: comment } %>
|
||||
<%= render partial: "cards/comments/reactions/reaction", collection: comment.reactions.ordered %>
|
||||
</div>
|
||||
|
||||
<%= turbo_frame_tag comment, :new_reaction do %>
|
||||
|
||||
Reference in New Issue
Block a user