Use a button to delete comments

As mentioned in commit 5311daadf, there are several reasons to use
buttons in these situations. And, as mentioned in the previous commits,
using buttons instead of links for actions requiring confirmation will
help us test for accessibility issues.
This commit is contained in:
Javi Martín
2024-10-11 04:24:20 +02:00
parent 26b24af413
commit 11ef917802
3 changed files with 13 additions and 8 deletions

View File

@@ -5,10 +5,10 @@
<% if can?(:hide, comment) || can?(:hide, comment.user) %>
<% if comment.author == current_user %>
<span class="divider">&nbsp;&bull;&nbsp;</span>
<%= link_to t("comments.actions.delete"),
hide_comment_path(comment),
method: :put, remote: true, class: "delete-comment",
data: { confirm: t("comments.actions.confirm_delete") } %>
<%= button_to t("comments.actions.delete"),
hide_comment_path(comment),
method: :put, remote: true, class: "delete-comment", form_class: "delete-comment-form",
data: { confirm: t("comments.actions.confirm_delete") } %>
<% else %>
<%= render Shared::ModerationActionsComponent.new(comment) %>
<% end %>