rubyforgood/babywearing

View on GitHub
app/views/loan_listing/_list.html.erb

Summary

Maintainability
Test Coverage
<%= render 'shared/pagination', items: loans %>
<table class="table">
  <thead>
    <tr>
      <th scope="col">Borrower</th>
      <th scope="col">Carrier</th>
      <th scope="col">Due</th>
      <th scope="col">Returned</th>
      <th scope="col">Notes</th>
      <th scope="col">Actions</th>
    </tr>
  </thead>
  <tbody>
    <% if loans.empty? %>
      <tr>
        <td colspan="100%">No loans to show</td>
      </tr>
    <% else %>
      <% loans.each do |loan| %>
        <tr>
          <td><%= link_to loan.borrower.name, user_path(loan.borrower) %></td>
          <td><%= link_to loan.carrier.display_name, carrier_path(loan.carrier) %></td>
          <td><%= loan.due_date %></td>
          <td><%= loan.returned_on %></td>
          <td><%= truncate(loan.notes) %></td>
          <td><%= link_to "Edit", edit_carrier_loan_path(loan.carrier, loan), class: 'btn btn-primary btn-sm', data: { modal: true } %></td>
        </tr>
      <% end %>
    <% end %>
  </tbody>
</table>