Skip to content

Instantly share code, notes, and snippets.

@jparker
Created May 28, 2009 06:31
Show Gist options
  • Save jparker/119137 to your computer and use it in GitHub Desktop.
Save jparker/119137 to your computer and use it in GitHub Desktop.
<!-- day.html.haml -->
<h1>Billables | Daily</h1>
<%= render :partial => 'billables' %>
<!-- week.html.haml -->
<h1>Billables | Weekly</h1>
<%= render :partial => 'billables' %>
<!-- month.html.haml -->
<h1>Billables | Monthly</h1>
<%= render :partial => 'billables' %>
<!-- _billables.html.haml -->
<table>
<thead>
<tr>
<th></th>
<th>Date</th>
<th>Vendor</th>
<th>Project</th>
<th>Rate</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="4">Total</td>
<td><%= number_to_currency @billables.to_a.sum(&:rate) %></td>
<td></td>
</tr>
</tfoot>
<tbody>
<% for billable in @billables %>
<% content_tag_for :tr, billable, :class => cycle('odd', 'even') do %>
<td>
<%= link_to 'view', billable %> |
<%= link_to 'edit', edit_billable_path(billable) %>
</td>
<td><%= billable.date.to_s(:short) %></td>
<td><%= h billable.vendor.name %></td>
<td><%= h billable.project.name %></td>
<td><%= number_to_currency billable.rate %></td>
<td>
<%= link_to 'delete', billable, :method => :delete %>
</td>
<% end %>
<% end %>
</tbody>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment