YaleSTC/shifts

View on GitHub
app/views/notices/_locations.html.erb

Summary

Maintainability
Test Coverage
<fieldset class = "index"><legend>Where:</legend>
<% if current_user.is_admin_of?(current_department) && notice.class.name != "Sticky" %>
      <%= check_box_tag :department_wide_locations, current_department.id, false %>
      <%= label_tag "department_wide_locations", text = current_department.name + " (all locations)"%>
<% end %>

<div id = "all_locations">
      <% for loc_group in current_department.loc_groups do %>
      <% next if !loc_group.active %>
      <% if current_user.is_admin_of?(loc_group) || notice.class.name == "Sticky" %>
    <li id = "notice_li">
       <%= check_box_tag "for_location_groups[]", loc_group.id, loc_group_checked_notice?(loc_group, notice)%>
       <%= label_tag "location_group_#{loc_group.id}", text = loc_group.name %>:
       <% for location in loc_group.locations do %>
        <% next if !location.active %>
          <%= check_box_tag "for_locations[]", location.id, location_checked_notice?(location, notice) %>
          <%= label_tag "location_#{location.id}", text = location.short_name %>
          <% unless location == loc_group.locations.last %>, <%end%>
       <% end %>
    </li>
  <% end %>
<% end %>
    </div>
</fieldset>