Files
fizzy/app/views/comments/edit.html.erb
T
2025-04-09 14:50:58 +02:00

27 lines
1.5 KiB
Plaintext

<%= turbo_frame_tag dom_id(@comment) do %>
<div class="comment__content comment--edit flex-inline flex-column full-width">
<div class="comment__body txt-align-start">
<%= form_with model: [@card.collection, @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 collection_card_comment_path(@card.collection, @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: collection_card_comment_path(@card.collection, @card, @comment), method: :delete, id: dom_id(@comment, :delete_form), data: { turbo_frame: "_top" } %>
</div>
</div>
<% end %>