YaleSTC/shifts

View on GitHub
app/views/users/_new_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_for user, :html=>{:id=>"user_form"} do |f| %>
  <%= f.error_messages %>
  <% if @user.auth_type == "built-in" && current_user!=@user && current_user.is_admin_of?(current_department)%>
   <h3>Reset Password?</h3>
     <div>
       <%= check_box_tag :reset_password %>
     </div>
 <% end %>
  <p>
    <%= f.label :login %><br />
    <%= f.text_field :login %>
  </p>
  <p>
    <%= f.label :first_name %><br />
    <%= f.text_field :first_name %>
  </p>
  <p>
    <%= f.label :nick_name %><br />
    <%= f.text_field :nick_name %>
  </p>
  <p>
    <%= f.label :last_name %><br />
    <%= f.text_field :last_name %>
  </p>
  <p>
    <%= f.label :email %><br />
    <%= f.text_field :email %>
  </p>
  <p>
    <%= f.label :employee_id, "Employee ID" %><br />
    <%= f.text_field :employee_id %>
  </p>
 <% if @appconfig.login_options.size >1 %>
  <p>
    <%= f.label :login_type %><br />
    <%= f.select(:auth_type, @appconfig.login_options, {selected: @user.auth_type || "CAS"}) %>
  </p>
  <% end %>
  <h3>Roles</h3>
  <% for role in @department.roles %>
    <div>
      <%= check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role) %>
      <%= role.name %>
    </div>
  <% end %>
  <p>
    <%= label_tag :payrate %><br />
    <%= text_field_tag :payrate %>
  </p>
  <p><%= f.submit submit %></p>
<% end %>
<% if @appconfig.use_ldap %>
<%#= observe_form :user_form, url: { action: 'ldap_search' }, frequency: 1, :loading=> "$('#loading_row').css({'display' : 'table-row'});$('.result').css({'display' : 'none'})" %>
<% end %>