This way it'll be easier for people using screen readers to know which element the checkbox is related to. Note that we're using the `aria-label` attribute because it makes testing with Capybara easier than using the `aria-labelledby` attribute. The only exception are the comments, since comments don't have a title and there isn't a proper label for them. In this case, we're using the title of the associated commentable as the label; we might change it in the future since there might be many comments for the same commentable.
41 lines
1.4 KiB
Plaintext
41 lines
1.4 KiB
Plaintext
<%= render Moderation::Shared::IndexComponent.new(@comments) do %>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th><%= t("moderation.comments.index.headers.comment") %></th>
|
|
<th><%= t("moderation.comments.index.headers.moderate") %></th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<% @comments.each do |comment| %>
|
|
<tr id="comment_<%= comment.id %>">
|
|
<td>
|
|
<%= comment.commentable_type.constantize.model_name.human %> -
|
|
<%= link_to comment.commentable.title,
|
|
commentable_path(comment),
|
|
id: dom_id(comment, :title) %>
|
|
<br>
|
|
<span class="date"><%= l comment.updated_at.to_date %></span>
|
|
<span class="bullet"> • </span>
|
|
<%= comment.flags_count %><span class="icon-flag flag-disable"></span>
|
|
<span class="bullet"> • </span>
|
|
<%= comment.author.username %>
|
|
<br>
|
|
<div class="moderation-description">
|
|
<%= comment.body %>
|
|
</div>
|
|
</td>
|
|
<td class="text-center">
|
|
<%= check_box_tag "comment_ids[]",
|
|
comment.id,
|
|
nil,
|
|
id: "#{dom_id(comment)}_check",
|
|
"aria-labelledby": dom_id(comment, :title) %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% end %>
|