swchoi727/LEP

View on GitHub
app/views/admins/users.html.haml

Summary

Maintainability
Test Coverage
 

= render 'admin_nav'


%h3 Students
%table.table
  %thead
    %tr
      %th
        =link_to 'First name', admin_users_path(:sort => 'first_name')
  %tbody
    - @users.each do |user|
      - if !user.admin
        %tr
          /%td= user.first_name
          /%td= user.last_name
          %td= link_to "#{user.first_name} #{user.last_name}", admin_show_user_path(:id => @user.id, :user_id => user.id), :method => :get
          - if user.active
            %td= link_to "Deactivate", admin_deactivate_user_path(:id => @user.id, :user_id => user.id, :authenticity_token => form_authenticity_token), :method => :put
            %td= link_to "Grant Admin", admin_make_admin_path(:id => @user.id, :user_id => user.id, :authenticity_token => form_authenticity_token), :method => :put
            - if user.group_leader == 'Yes'
              - if user.facilitator
                %td= link_to "Revoke Facilitator", admin_revoke_facilitator_path(:id => @user.id, :user_id => user.id, :authenticity_token => form_authenticity_token), :method => :put
              - if !user.facilitator
                %td= link_to "Grant Facilitator", admin_make_facilitator_path(:id => @user.id, :user_id => user.id, :authenticity_token => form_authenticity_token), :method => :put
          - else
            %td= link_to "Activate", admin_activate_user_path(:id => @user.id, :user_id => user.id, :authenticity_token => form_authenticity_token), :method => :put