<%= back_link_to admin_question_path(@option.question) %>

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

<h2 class="inline-block">
  <%= t("admin.answers.videos.index.title") %>
</h2>

<% if can?(:create, Poll::Question::Option.new(question: @option.question)) %>
  <%= link_to t("admin.answers.videos.index.add_video"),
              new_admin_option_video_path(@option),
              class: "button success float-right" %>
<% else %>
  <div class="callout warning">
    <strong><%= t("admin.questions.no_edit") %></strong>
  </div>
<% end %>

<div>

  <table>
    <thead>
      <tr>
        <th><%= t("admin.answers.videos.index.video_title") %></th>
        <th><%= t("admin.answers.videos.index.video_url") %></th>
        <th><%= t("admin.actions.actions") %></th>
      </tr>
    </thead>

    <tbody>
      <% @videos.each do |video| %>
        <tr id="<%= dom_id(video) %>" class="poll_question_option_video">
          <td><%= video.title %></td>
          <td><%= link_to video.url, video.url %></td>
          <td>
            <%= render Admin::Poll::Questions::Options::Videos::TableActionsComponent.new(video) %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>

</div>
