deepakvenkat/cash-envelope

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

Summary

Maintainability
Test Coverage
<h2>Your Envelopes </h2>

<div class="nav breadcrumb">
  <%= link_to('Refresh all envelopes', refresh_all_envelopes_path) %>
  <%= link_to('Create a new envelope', new_envelope_path) %>
  <%= link_to('Home', user_path(current_user)) %>
</div>
<div class='container envelopes'>
  <table id='envelopes-list' class='table'>
    <thead>
      <tr>
        <th>Name </th>
        <th>Balance </th>
        <th>Limit </th>
        <th>Days left </th>
        <th>Actions </th>
        <th>Add Transactions </th>
        <th>View transactions </th>
        <th> Refresh </th>
      </tr>
  </thead>
    <% @envelopes.each do |envelope| %>
      <tr>
        <td><%= envelope.name %></td>
        <td><%= envelope.balance %></td>
        <td><%= envelope.limit %></td>
        <td><%= days_left %></td>
        <td><%= link_to 'Edit', edit_envelope_path(envelope) %>, <%= link_to 'Delete', envelope_path(envelope), method: :delete %></td>
        <td><%= link_to(content_tag(:i, '', class: 'icon-plus-sign'), new_transaction_path(envelope: envelope.id)) %> </td>
        <td><%= link_to('This month', transactions_path(envelope: envelope.id, this_month: true)) %>, <%= link_to('All', transactions_path(envelope: envelope.id, this_month: false))  %></td>
        <td><%= link_to(content_tag(:i, '', class: 'icon-refresh'), refresh_envelope_path(envelope.id )) %>
      </tr>
    <% end %>
  </ul>
</div>