<%= render Admin::Poll::Questions::FilterComponent.new(@polls) %>

<% if @questions.count == 0 %>
  <div class="callout primary margin-top">
    <%= t("admin.questions.index.no_questions") %>
  </div>
<% else %>
  <table>
    <thead>
      <tr>
        <th><%= t("admin.questions.index.table_question") %></th>
        <th><%= t("admin.questions.index.table_poll") %></th>
        <th><%= t("admin.actions.actions") %></th>
      </tr>
    </thead>
    <tbody>
      <% @questions.each do |question| %>
        <tr id="<%= dom_id(question) %>">
          <td><%= question.title %></td>
          <td>
            <% if question.poll.present? %>
              <%= question.poll.name %>
            <% else %>
              <em><%= t("admin.questions.index.poll_not_assigned") %></em>
            <% end %>
          </td>
          <td>
            <%= render Admin::TableActionsComponent.new(question) do |actions| %>
              <%= actions.action(:options, text: t("admin.polls.show.edit_answers")) %>
            <% end %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>

  <%= paginate @questions %>
<% end %>
