vegantech/sims

View on GitHub
app/views/district/schools/_label_form.html.erb

Summary

Maintainability
Test Coverage
  <%= label_form.error_messages %>
  <fieldset>

  <%= label_form.text_field :name %>
  <%= label_form.text_field :district_school_id, :label => "SIS Primary Key", 
      :help => "The primary key used in your Student Information System for the school.  #{id_district_desc(label_form.object)}" %>


  <h2>Explicit User Assignments</h2>
    (All students in district implies regular access to all schools)  The label_format of this may change.    Be sure to hit update after adding, changing, or removing user school assignments.

    <div class="awesome_nested">
    <table>
      <thead>
      <tr><th>User</th>
      <th>School Admin
      <%= help_popup("A school admin can administer the quicklist, create groups, and assign students and users to groups for this school.") %> </th>

    </thead>
    <tbody id = "user_school_assignments" class="items">
      <%=label_form.nested_fields_for :user_school_assignments, :render_template => false do |f|%>
        <tr class="user_school_assignment item">
          <td>
            <% if @users %>
              <%= f.collection_select('user_id', @users, :id, :to_s) %>
            <% else %>
              <%= f.hidden_field 'user_id' %> <%=f.object.try(:user).to_s%>
            <% end %>
          </td>
          <td>
            <%= f.check_box :admin %>
          </td>
          <td>
            <%=f.hidden_field :id %>
            <%=f.hidden_field :_destroy %>
            <%= link_to "Remove", "#", :class => "remove" %>
          </td>
        </tr>
        <% end %>
    </tbody>
  </table>

  <div>
    <% if @users %>
      <%= link_to "Add a user","#", :class => "add" %>
      <%= nested_fields_templates %>
    <% else %>
      <p>There are more than 100 users in the district; please assign new  school assignments through the add/remove users interface.</p>
    <% end %>
  </div>
</div>
</fieldset>