BathHacked/energy-sparks

View on GitHub
app/views/admin/case_studies/index.html.erb

Summary

Maintainability
Test Coverage
<h1>Case Studies</h1>

<% if @case_studies %>

<table class="table">
  <thead>
    <tr>
      <th>Title</th>
      <th>Description</th>
      <th>Position</th>
      <th>File</th>
      <th>Actions</th>
    </tr>
  </thead>

  <tbody>
    <% @case_studies.each do |case_study| %>
      <tr>
        <td><%= case_study.title %></td>
        <td><%= case_study.description %></td>
        <td><%= case_study.position %></td>
        <td class="text-nowrap">
          <%= t_attached_links(case_study, :file, " | ") %>
        </td>
        <td>
          <div class="btn-group">
            <%= link_to 'Edit', edit_admin_case_study_path(case_study), class: 'btn' %>
            <%= link_to 'Delete', admin_case_study_path(case_study), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn' %>
          </div>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<% else %>
  <p>There are no case studies</p>
<% end %>

<p><%= link_to 'New Case study', new_admin_case_study_path, class: 'btn'%></p>