Fix: edit comment button disappears when morphing the page

This also replaces the ad-hoc stimulus controller with the pure-css based
solution we recently added.

https://app.fizzy.do/5986089/cards/3243
This commit is contained in:
Jorge Manrubia
2025-12-02 07:06:50 +01:00
parent ed6b0da48a
commit 11249949eb
4 changed files with 3 additions and 23 deletions
-4
View File
@@ -82,10 +82,6 @@
.comment__edit {
background-color: var(--color-ink-lightest);
.comment:not(.comment--mine) & {
display: none;
}
}
.comment--mine {
+1 -5
View File
@@ -3,10 +3,6 @@ module MessagesHelper
turbo_frame_tag dom_id(card, :messages),
class: "comments gap center",
style: "--card-color: #{card.color}",
role: "group", aria: { label: "Messages" },
data: {
controller: "created-by-current-user",
created_by_current_user_mine_class: "comment--mine"
}, &
role: "group", aria: { label: "Messages" }, &
end
end
@@ -1,12 +0,0 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = [ "creation" ]
static classes = [ "mine" ]
creationTargetConnected(element) {
if (element.dataset.creatorId == Current.user.id) {
element.classList.add(this.mineClass)
}
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
<% cache comment do %>
<%= turbo_frame_tag comment, :container do %>
<%# Bump for CSS changes: 2025-06-30 -%>
<div id="<%= dom_id(comment) %>" class="comment flex align-start full-width <%= "comment--system" if comment.creator.system? %>" data-creator-id="<%= comment.creator_id %>" data-created-by-current-user-target="creation">
<div id="<%= dom_id(comment) %>" data-creator-id="<%= comment.creator_id %>" class="comment flex align-start full-width <%= "comment--system" if comment.creator.system? %>">
<figure class="comment__avatar flex-item-no-shrink" aria-hidden="true">
<%= avatar_tag comment.creator, hidden_for_screen_reader: true %>
</figure>
@@ -20,7 +20,7 @@
</h3>
<%= link_to edit_card_comment_path(comment.card, comment),
class: "comment__edit btn btn--circle borderless translucent" do %>
class: "comment__edit btn btn--circle borderless translucent", data: { only_visible_to_you: true } do %>
<%= icon_tag "menu-dots-horizontal" %>
<span class="for-screen-reader">Edit this comment</span>
<% end %>