Files
fizzy/app/views/cards/comments/edit.html.erb
T
2025-05-29 14:22:27 +02:00

33 lines
1.7 KiB
Plaintext

<%= turbo_frame_tag @comment do %>
<div class="comment flex align-start full-width">
<figure class="comment__avatar flex-item-no-shrink" aria-hidden="true">
<%= avatar_tag @comment.creator, hidden_for_screen_reader: true %>
</figure>
<div class="comment__content flex flex-column flex-item-grow full-width">
<div class="comment__body markdown-content txt-align-start">
<%= form_with model: [ @card, @comment ], class: "flex flex-column gap full-width",
data: { controller: "form paste", action: "keydown.ctrl+enter->form#submit:prevent keydown.meta+enter->form#submit:prevent keydown.esc->form#cancel:stop paste->paste#pasteFiles" } do |form| %>
<%= form.markdown_area :body, class: "input comment__input", required: true, autofocus: true, placeholder: new_comment_placeholder(@card) %>
<div class="flex gap-half justify-start">
<%= form.button class: "btn btn--reversed", type: :submit do %>
<span>Save changes</span>
<% end %>
<%= link_to card_comment_path(@card, @comment), class: "btn", data: { form_target: "cancel" } do %>
<span>Cancel</span>
<% end %>
<%= tag.button type: :submit, class: "btn btn--negative flex-item-justify-end", form: dom_id(@comment, :delete_form),
data: { turbo_confirm: "Are you sure you want to delete this comment?" } do %>
<%= icon_tag "trash" %>
<span class="for-screen-reader">Delete</span>
<% end %>
</div>
<% end %>
<%= form_with url: card_comment_path(@card, @comment), method: :delete, id: dom_id(@comment, :delete_form), data: { turbo_frame: "_top" } %>
</div>
</div>
</div>
<% end %>