BigW Consortium Gitlab

index.html.haml 5.19 KB
Newer Older
1
- page_title "Users"
2 3
= render 'shared/show_aside'

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
.admin-filter
  %ul.nav-links
    %li{class: "#{'active' unless params[:filter]}"}
      = link_to admin_users_path do
        Active
        %small.badge= number_with_delimiter(User.active.count)
    %li{class: "#{'active' if params[:filter] == "admins"}"}
      = link_to admin_users_path(filter: "admins") do
        Admins
        %small.badge= number_with_delimiter(User.admins.count)
    %li.filter-two-factor-enabled{class: "#{'active' if params[:filter] == 'two_factor_enabled'}"}
      = link_to admin_users_path(filter: 'two_factor_enabled') do
        2FA Enabled
        %small.badge= number_with_delimiter(User.with_two_factor.count)
    %li.filter-two-factor-disabled{class: "#{'active' if params[:filter] == 'two_factor_disabled'}"}
      = link_to admin_users_path(filter: 'two_factor_disabled') do
        2FA Disabled
        %small.badge= number_with_delimiter(User.without_two_factor.count)
22 23 24 25
    %li.filter-external{class: "#{'active' if params[:filter] == 'external'}"}
      = link_to admin_users_path(filter: 'external') do
        External
        %small.badge= number_with_delimiter(User.external.count)
26 27 28 29 30 31 32 33
    %li{class: "#{'active' if params[:filter] == "blocked"}"}
      = link_to admin_users_path(filter: "blocked") do
        Blocked
        %small.badge= number_with_delimiter(User.blocked.count)
    %li{class: "#{'active' if params[:filter] == "wop"}"}
      = link_to admin_users_path(filter: "wop") do
        Without projects
        %small.badge= number_with_delimiter(User.without_projects.count)
34

35
  .row-content-block.second-block
36 37 38
    .pull-right
      .dropdown.inline
        %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
39
          %span.light
40 41 42 43 44 45
          - if @sort.present?
            = sort_options_hash[@sort]
          - else
            = sort_title_name
          %b.caret
        %ul.dropdown-menu
46
          %li
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
            = link_to admin_users_path(sort: sort_value_name, filter: params[:filter]) do
              = sort_title_name
            = link_to admin_users_path(sort: sort_value_recently_signin, filter: params[:filter]) do
              = sort_title_recently_signin
            = link_to admin_users_path(sort: sort_value_oldest_signin, filter: params[:filter]) do
              = sort_title_oldest_signin
            = link_to admin_users_path(sort: sort_value_recently_created, filter: params[:filter]) do
              = sort_title_recently_created
            = link_to admin_users_path(sort: sort_value_oldest_created, filter: params[:filter]) do
              = sort_title_oldest_created
            = link_to admin_users_path(sort: sort_value_recently_updated, filter: params[:filter]) do
              = sort_title_recently_updated
            = link_to admin_users_path(sort: sort_value_oldest_updated, filter: params[:filter]) do
              = sort_title_oldest_updated

      = link_to 'New User', new_admin_user_path, class: "btn btn-new"
    = form_tag admin_users_path, method: :get, class: 'form-inline' do
      .form-group
        = search_field_tag :name, params[:name], placeholder: 'Name, email or username', class: 'form-control', spellcheck: false
        = hidden_field_tag "filter", params[:filter]
      = button_tag class: 'btn btn-primary' do
        %i.fa.fa-search


.panel.panel-default
  %ul.well-list
    - @users.each do |user|
      %li
        .list-item-name
          - if user.blocked?
77
            = icon("lock", class: "cred")
78
          - else
79
            = icon("user", class: "cgreen")
80 81 82
          = link_to user.name, [:admin, user]
          - if user.admin?
            %strong.cred (Admin)
83 84
          - if user.external?
            %strong.cred (External)
85 86 87 88 89 90 91
          - if user == current_user
            %span.cred It's you!
        .pull-right
          %span.light
            %i.fa.fa-envelope
            = mail_to user.email, user.email, class: 'light'
           
92 93 94 95 96 97 98 99 100
          .pull-right
            = link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: 'btn-grouped btn btn-xs'
            - unless user == current_user
              - if user.ldap_blocked?
                = link_to '#', title: 'Cannot unblock LDAP blocked users', data: {toggle: 'tooltip'}, class: 'btn-grouped btn btn-xs btn-success disabled' do
                  %i.fa.fa-lock
                  Unblock
              - elsif user.blocked?
                = link_to 'Unblock', unblock_admin_user_path(user), method: :put, class: 'btn-grouped btn btn-xs btn-success'
101
              - else
102 103 104 105 106
                = link_to 'Block', block_admin_user_path(user), data: {confirm: 'USER WILL BE BLOCKED! Are you sure?'}, method: :put, class: 'btn-grouped btn btn-xs btn-warning'
              - if user.access_locked?
                = link_to 'Unlock', unlock_admin_user_path(user), method: :put, class: 'btn-grouped btn btn-xs btn-success', data: { confirm: 'Are you sure?' }
              - if user.can_be_removed?
                = link_to 'Destroy', [:admin, user], data: { confirm: "USER #{user.name} WILL BE REMOVED! All issues, merge requests and groups linked to this user will also be removed! Maybe block the user instead? Are you sure?" }, method: :delete, class: 'btn-grouped btn btn-xs btn-remove'
107
= paginate @users, theme: "gitlab"