gregmolnar/invoicer

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

Summary

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

<table class="table">
  <thead>
    <tr>
      <th>Invoice number</th>
      <th>Due date</th>
      <th>Client</th>
      <th>Invoice status</th>
      <th>Total</th>
      <th></th>
    </tr>
  </thead>

  <tbody>
    <% @invoices.each do |invoice| %>
      <tr>
        <td><%= invoice.invoice_number %></td>
        <td><%= invoice.due_date %></td>
        <td><%= invoice.name %></td>
        <td><%= invoice.invoice_status.name %></td>
        <td><%= number_to_currency invoice.total %></td>
        <td>
          <%= link_to 'Show', invoice_path(invoice, format: :pdf), class: 'btn btn-small' %>
          <%= link_to 'Edit', edit_invoice_path(invoice), class: 'btn btn-small' %>
          <%= link_to 'Destroy', invoice, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-small btn-danger' %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>
<%= link_to 'New Invoice', new_invoice_path, class: 'btn btn-small btn-primary' %>