quidproquo/mr_video

View on GitHub
app/views/mr_video/cassettes/index.html.erb

Summary

Maintainability
Test Coverage
<% content_for(:title) { 'Cassettes' } %>
<div class="row">
  <div class="col-md-12">
    <h1>Cassettes <small class="text-muted"><%= @cassettes.count %></small></h1>
    <table class="table table-hover">
      <thead>
        <tr>
          <th scope="col" style="width: 4em" data-searchable="false" data-orderable="false" class="text-right">#</th>
          <th scope="col" style="width: 80%">Name</th>
          <th scope="col" style="width: 5em" data-searchable="false" class="text-right">Episodes</th>
          <th scope="col" style="width: 20%" data-searchable="false">Last Updated</th>
          <th scope="col" style="width: 9em" data-searchable="false" data-orderable="false" class="text-center">Action</th>
        </tr>
      </thead>
      <tbody>
        <% @cassettes.each do |cassette| %>
          <tr id="cassette_<%= cassette.id %>_row">
            <th scope="row" class="text-right"></th>
            <td title="<%= cassette.name %>"><%= link_to(cassette.name, cassette_path(cassette)) %></td>
            <td class="text-right"><%= cassette.episodes.count %></td>
            <td class="small text-muted" title="<%= cassette.updated_at %>" data-sort="<%= cassette.updated_at.to_i %>"><%= time_ago_in_words(cassette.updated_at) %> ago</td>
            <td class="text-center">
              <%= link_to('Delete', cassette_path(cassette), method: :delete, data: { confirm: "Are you sure you want to delete the \"#{cassette.name}\" cassette?", severity: 'danger' }, remote: true, class: 'btn btn-outline-danger btn-sm') %>
            </td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
</div>