app/views/stats/show.html.erb
<% title (@shift.scheduled? ? "Shift" : "Unscheduled Shift") %>
<p>
<strong>Start:</strong>
<%= @shift.start.to_s(:short_name) %>
</p>
<p>
<strong>End:</strong>
<%= @shift.scheduled? ? @shift.end.to_s(:short_name) : "unscheduled" %>
</p>
<p>
<strong>User:</strong>
<%= @shift.user.name %>
</p>
<p>
<strong>Location:</strong>
<%= @shift.location.name %>
</p>
<p>
<% if @shift.report %>
<%= link_to "View report", shift_report_path(@shift) %>
<% elsif current_user==@shift.user %>
<p>
<%= link_to "Request a sub for this shift", new_shift_sub_request_path(@shift) %>
</p>
<%= button_to "Sign in", shift_report_path(@shift), method: :post %>
<% else %>
This shift has not yet been signed in to.
<% end %>
</p>
<p>
<%= link_to "Edit", edit_shift_path(@shift) %> |
<%= link_to "Destroy", @shift, confirm: 'Are you sure?', method: :delete %> |
<%= link_to "View All", shifts_path %>
</p>