<h2><%= t("admin.debates.index.title") %></h2>

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

<% if @debates.any? %>
  <h3 class="margin"><%= page_entries_info @debates %></h3>

  <table>
    <thead>
      <th scope="col"><%= t("admin.shared.title") %></th>
      <th scope="col" class="small-6"><%= t("admin.shared.description") %></th>
      <th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
    </thead>
    <tbody>
    <% @debates.each do |debate| %>
      <tr id="<%= dom_id(debate) %>">
        <td class="align-top">
          <strong><%= debate.title %></strong>
        </td>
        <td>
          <div class="moderation-description">
            <%= debate.description %>
          </div>
        </td>
        <td class="align-top">
          <%= link_to t("admin.actions.restore"),
                restore_admin_debate_path(debate, request.query_parameters),
                method: :put,
                data: { confirm: t("admin.actions.confirm") },
                class: "button hollow warning" %>
          <% unless debate.confirmed_hide? %>
            <%= link_to t("admin.actions.confirm_hide"),
                  confirm_hide_admin_debate_path(debate, request.query_parameters),
                  method: :put,
                  class: "button" %>
          <% end %>
        </td>
      </tr>
    <% end %>
    </tbody>
  </table>

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