YaleSTC/shifts

View on GitHub
app/views/templates/index.html.erb

Summary

Maintainability
Test Coverage
<% title "Templates for #{@department.name}" %>

<table class="tablesorter">
 <thead>
  <tr>
    <th>Name</th>
    <% unless mobile_device?%>
    <th colspan=2>Total hours</th>
    <th colspan=2>Continuous hours</th>
    <th colspan=2>Number of shifts</th>
    <th>Hours per day</th>
        <th>Roles</th>
        <th>Locations</th>
  </tr>
  <tr>
    <th></th>
    <th>Max</th>
    <th>Min</th>
    <th>Max</th>
    <th>Min</th>
    <th>Max</th>
    <th>Min</th>
    <th>Max</th>
        <th></th>
        <th></th>
    <% end %>
  </tr>
</thead>

<% @week_templates.each do |template| %>
<tbody>
<tr>
    <td><%= link_to template.name, template_path(template)%></td>
    <% unless mobile_device?%>
    <td><%= template.max_total_hours %></td>
    <td><%= template.min_total_hours %></td>
    <td><%= template.max_continuous_hours %></td>
    <td><%= template.min_continuous_hours %></td>
    <td><%= template.max_number_of_shifts %></td>
    <td><%= template.min_number_of_shifts %></td>
    <td><%= template.max_hours_per_day %></td>
        <td><%= template.roles.collect{|role| role.name}.to_sentence %></td>
        <td><%= template.timeslot_locations.uniq.collect{|loc| loc.short_name}.to_sentence %></td>
        <td><%= link_to 'Shift Preferences', template_shift_preferences_path(template) %></td>
        <td><%= link_to 'Requested Shifts', template_requested_shifts_path(template) %></td>
        <td><%= link_to 'Timeslots', template_template_time_slots_path(template) %></td>
    <td><%= link_to 'View', template %></td>
    <td><%= link_to 'Edit', edit_template_path(template) %></td>
    <td><%= link_to 'Delete', template, confirm: 'Are you sure?', method: :delete %></td>
    <% end %>
  </tr>
 </tbody>
<% end %>
</table>

<br />