<%= back_link_to %>

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

<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 %>
  </div>
</div>

<div class="clear">
  <%= link_to t("admin.questions.show.add_answer"), new_admin_question_answer_path(@question),
              class: "button float-right" %>
</div>

<table class="margin-top">
  <tr>
    <th colspan="5" scope="col" class="with-button">
      <%= t('admin.questions.show.valid_answers') %>
    </th>
  </tr>

  <tr>
    <th><%= t("admin.questions.show.answers.title") %></th>
    <th scope="col" class="medium-7"><%= t("admin.questions.show.answers.description") %></th>
    <th scope="col" class="text-center"><%= t("admin.questions.show.answers.images") %></th>
    <th scope="col" class="text-center"><%= t("admin.questions.show.answers.documents") %></th>
    <th scope="col" class="text-center"><%= t("admin.questions.show.answers.videos") %></th>
  </tr>

  <tbody class="sortable" data-js-url="<%= admin_question_answers_order_answers_path(@question.id) %>">
    <% @question.question_answers.each do |answer| %>
      <tr id="<%= dom_id(answer) %>" class="poll_question_answer" data-answer-id="<%= answer.id %>">
        <td class="align-top"><%= link_to answer.title, admin_answer_path(answer) %></td>
        <td class="align-top break"><%= answer.description %></td>
        <td class="align-top text-center">
          (<%= answer.images.count %>)
          <br>
          <%= link_to t("admin.questions.show.answers.images_list"),
                      admin_answer_images_path(answer) %>
        </td>
        <td class="align-top text-center">
          (<%= answer.documents.count rescue 0 %>)
          <br>
          <%= link_to t("admin.questions.show.answers.documents_list"),
                      admin_answer_documents_path(answer) %>
        </td>
        <td class="align-top text-center">
          (<%= answer.videos.count %>)
          <br>
          <%= link_to t("admin.questions.show.answers.video_list"),
                      admin_answer_videos_path(answer) %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<% if @question.video_url.present? %>
  <p>
    <strong><%= t("admin.questions.show.video_url") %></strong>
    <br>
    <a href="<%= @question.video_url %>"><%= @question.video_url %></a>
  </p>
<% end %>
