Skip to content

Instantly share code, notes, and snippets.

@mrkurt
Forked from anonymous/gist:10485825
Last active August 29, 2015 13:59
Show Gist options
  • Save mrkurt/10486188 to your computer and use it in GitHub Desktop.
Save mrkurt/10486188 to your computer and use it in GitHub Desktop.
<h3>Hours Worked</h3>
<% user_signed_in? %>
<table>
<table class="table table-striped table-bordered table-condensed table-hover">
<thead>
<thead>
<tr>
<th>Date</th>
<th>Hours Worked</th>
<th>Start</th>
<th>Finish</th>
<th>Description</th>
<th>User</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @hours.sort { |a,b| a.date <=> b.date }.each do |hour| %>
<tr>
<td><%= hour.date.to_s(:long)%></td>
<td><%= hour.elapsed_time%></td>
<td><%= hour.start.strftime("%I:%M %p") %></td>
<td><%= hour.finish.strftime("%I:%M %p") %></td>
<td><%= hour.description %></td>
<td><%= hour.user.name %></td>
<td><%= link_to 'Details,', hour %>
<%= link_to 'Edit,', edit_hour_path(hour) %>
<%= link_to 'Delete', hour, method: :delete, data: { confirm: 'Are you sure?' } %>
</td>
</tr>
<% end %>
</tbody>
<tfoot>
<tr>
<td>&nbsp;</td>
<td><%= hours.map(&:elapsed_time).reduce(&:+) %></td>
<td colspan=5">&nbsp;</td>
</tr>
</tfoot>
</table>
<br>
<%= link_to 'New', new_hour_path %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment