kamen-hursev/media-blog

View on GitHub
app/views/reports/index.html.erb

Summary

Maintainability
Test Coverage
<h1>Listing reports</h1>

<table class="table">
  <thead>
    <tr>
      <th>Title</th>
      <th>Slug</th>
      <th>Owner</th>
      <th></th>
    </tr>
  </thead>

  <tbody>
    <% @reports.each do |report| %>
      <tr>
        <td><%= report.title %></td>
        <td><%= report.slug %></td>
        <td><%= report.owner.email %></td>
        <td>
          <%= link_to 'Show', report, class: 'btn-show' if can? :read, report %>
          <%= link_to 'Edit', edit_report_path(report), class: 'btn-edit' if can? :edit, report %>
          <%= link_to 'Destroy', report, method: :delete, class: 'btn-destroy', data: { confirm: 'Are you sure?' } if can? :destroy, report %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to 'New Report', new_report_path, class: 'btn btn-link' if can? :create, Report %>