YaleSTC/shifts

View on GitHub
app/views/template_time_slots/_all_time_slots.html.erb

Summary

Maintainability
Test Coverage
<table class = "tablesorter">
    <thead>
        <tr>
          <th>Day</th>
          <th>Start</th>
          <th>End</th>
            <th>Location</th>
        </tr>
     </thead>

    <% template_time_slots.each do |template_time_slot| %>
  <tbody>
    <tr>
          <td><%= RequestedShift::WEEK_DAY_SELECT[template_time_slot.day][0] %></td>
          <td><%= template_time_slot.start_time.strftime("%I:%M %p") %></td>
          <td><%= template_time_slot.end_time.strftime("%I:%M %p") %></td>
            <td><%= template_time_slot.location.short_name %></td>
            <% if current_user.is_admin_of?(@week_template.department) %>
                <td><%= link_to 'Edit', edit_template_template_time_slot_path(@week_template, template_time_slot) %></td>
                <td><%= link_to 'Delete', template_time_slot, confirm: 'Are you sure?', method: :delete %></td>
            <% end %>
        </tr>
   </tbody>
    <% end %>
</table>
<% if template_time_slots.empty? %>
    This template has no time slots. Please add some below.
<% end %>