YaleSTC/shifts

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

Summary

Maintainability
Test Coverage
<% title "Location Groups" %>

<table class = "tablesorter">
  <thead>
  <tr>
    <th>Name</th>
    <% unless mobile_device?%>
      <th>Locations</th>
      <th>Public</th>
      <th>Edit</th>
      <th>Status</th>
    <% end %>
  </tr>
  </thead>
  <tbody>
  <% for loc_group in @loc_groups %>
    <tr id="loc_group<%= loc_group.id%>" <%=  loc_group.active ? "" : raw("class='disabled'") %>>
    <td><%= link_to loc_group.name, loc_group_path(loc_group) %></td>
      <% unless mobile_device?%>
      <td><%= loc_group.locations.collect{|loc| loc.name} * ", " %></td>
      <td><%= loc_group.public %></td>
        <td><%= link_to "Edit", edit_loc_group_path(loc_group)%></td>
        <td><%= link_to (loc_group.active ? "Deactivate" : "Restore"), toggle_loc_group_path(loc_group), remote: true, class: 'toggle_link'%></td>
      <% end %>
  <% end %>
  </tbody>
</table>
<br />
<% if current_user.is_admin_of?(@department) %>
  <%= render partial: 'form', locals: {title: "Add a new location group"}%>
<% end %>