<h2><%= t("admin.hidden_comments.index.title") %></h2>
<%= render Admin::SearchComponent.new(label: t("admin.shared.search.label.comments")) %>
<p><%= t("admin.shared.moderated_content") %></p>

<%= render "shared/filter_subnav", i18n_namespace: "admin.hidden_comments.index" %>

<% if @comments.any? %>
  <h3><%= page_entries_info @comments %></h3>

  <table>
    <thead>
      <th scope="col" class="small-8"><%= t("admin.shared.description") %></th>
      <th scope="col"><%= t("admin.shared.actions") %></th>
    </thead>
    <tbody>
      <% @comments.each do |comment| %>
        <tr id="<%= dom_id(comment) %>">
          <td>
            <%= sanitize_and_auto_link comment.body %><br>
            <% if comment.commentable.hidden? %>
              (<%= t("admin.hidden_comments.index.hidden_#{comment.commentable_type.downcase}") %>: <%= comment.commentable.title %>)
            <% else %>
              <%= link_to comment.commentable.title, commentable_path(comment) %>
            <% end %>
          </td>
          <td>
            <%= render Admin::HiddenTableActionsComponent.new(comment) %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>

  <%= paginate @comments %>
<% else %>
  <div class="callout primary margin">
    <%= t("admin.hidden_comments.index.no_hidden_comments") %>
  </div>
<% end %>
