consul/consul

View on GitHub
app/views/admin/poll/questions/answers/videos/index.html.erb

Summary

Maintainability
Test Coverage
<%= back_link_to admin_question_path(@answer.question) %>

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

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

<% if can?(:create, Poll::Question::Answer.new(question: @answer.question)) %>
  <%= link_to t("admin.answers.videos.index.add_video"),
              new_admin_answer_video_path(@answer),
              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_answer_video">
          <td><%= video.title %></td>
          <td><%= link_to video.url, video.url %></td>
          <td>
            <%= render Admin::Poll::Questions::Answers::Videos::TableActionsComponent.new(video) %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>

</div>