Skip to content

Instantly share code, notes, and snippets.

Created April 11, 2014 17:23
Show Gist options
  • Save anonymous/10485825 to your computer and use it in GitHub Desktop.
Save anonymous/10485825 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.start - hour.finish)/60/60*-1).round(2)%></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>
</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