<%= back_link_to admin_poll_path(@question.poll) %>

<% if can?(:update, @question) %>
  <%= link_to t("admin.questions.show.edit_question"), edit_admin_question_path(@question),
              class: "button hollow float-right" %>
<% end %>

<div class="clear"></div>

<div class="small-12 medium-6">
  <div class="callout highlight">
    <p>
      <strong><%= t("admin.questions.show.question") %></strong>
      <br>
      <%= @question.title %>
    </p>

    <p>
      <strong><%= t("admin.questions.show.author") %></strong>
      <br>
      <%= link_to @question.author.name, user_path(@question.author) %>
    </p>

    <% if @question.proposal.present? %>
      <p>
        <strong><%= t("admin.questions.show.proposal") %></strong>
        <br>
        <%= link_to @question.proposal.title, proposal_path(@question.proposal) %>
      </p>
    <% end %>

    <% if @question.votation_type.present? %>
      <p>
        <strong><%= t("admin.polls.votation_type.title") %></strong>
        <br>
        <%= VotationType.human_attribute_name("vote_type.#{@question.vote_type}") %>
      </p>
      <% if @question.multiple? %>
        <p>
          <strong><%= VotationType.human_attribute_name("max_votes") %></strong>
          <br>
          <%= @question.max_votes %>
        </p>
      <% end %>
    <% end %>
  </div>
</div>

<% if @question.accepts_options? %>
  <div class="clear">
    <% if can?(:create, Poll::Question::Option.new(question: @question)) %>
      <%= link_to t("admin.questions.show.add_answer"), new_admin_question_option_path(@question),
                  class: "button float-right" %>
    <% else %>
      <div class="callout warning">
        <strong><%= t("admin.questions.no_edit") %></strong>
      </div>
    <% end %>
  </div>

  <%= render Admin::Poll::Questions::Options::TableComponent.new(@question) %>
<% end %>
