Files
grecia/app/components/comments/votes_component.html.erb
taitus 5009bf6c37 Add aria-pressed to in comments votes component
In order to the users using screen readers know whether the button is pressed
or not.
2023-10-06 18:13:45 +02:00

27 lines
886 B
Plaintext

<div class="votes">
<%= t("comments.comment.votes", count: comment.total_votes) %>
&nbsp;|&nbsp;
<span class="in-favor">
<%= button_to vote_comment_path(comment, value: "yes"),
method: "post",
remote: can?(:vote, comment),
"aria-pressed": pressed?("yes"),
title: t("votes.agree") do %>
<span class="show-for-sr"><%= t("votes.agree") %></span>
<% end %>
<%= comment.total_likes %>
</span>
<span class="against">
<%= button_to vote_comment_path(comment, value: "no"),
method: "post",
remote: can?(:vote, comment),
"aria-pressed": pressed?("no"),
title: t("votes.disagree") do %>
<span class="show-for-sr"><%= t("votes.disagree") %></span>
<% end %>
<%= comment.total_dislikes %>
</span>
</div>