BigW Consortium Gitlab

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

4
.row
5
  %aside.col-md-3
6 7 8 9 10 11 12 13 14 15
    .admin-filter
      %ul.nav.nav-pills.nav-stacked
        %li{class: "#{'active' unless params[:filter]}"}
          = link_to admin_users_path do
            Active
            %small.pull-right= User.active.count
        %li{class: "#{'active' if params[:filter] == "admins"}"}
          = link_to admin_users_path(filter: "admins") do
            Admins
            %small.pull-right= User.admins.count
16 17 18 19 20 21 22 23
        %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.pull-right= 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.pull-right= User.without_two_factor.count
24 25 26 27 28 29 30 31 32
        %li{class: "#{'active' if params[:filter] == "blocked"}"}
          = link_to admin_users_path(filter: "blocked") do
            Blocked
            %small.pull-right= User.blocked.count
        %li{class: "#{'active' if params[:filter] == "wop"}"}
          = link_to admin_users_path(filter: "wop") do
            Without projects
            %small.pull-right= User.without_projects.count
      %hr
33 34
      = form_tag admin_users_path, method: :get, class: 'form-inline' do
        .form-group
35
          = search_field_tag :name, params[:name], placeholder: 'Name, email or username', class: 'form-control', spellcheck: false
36
          = hidden_field_tag "filter", params[:filter]
37
        = button_tag class: 'btn btn-primary' do
38
          %i.fa.fa-search
39
      %hr
40
      = link_to 'Reset', admin_users_path, class: "btn btn-cancel"
41

42
  %section.col-md-9
43
    .panel.panel-default
44
      .panel-heading
45
        Users (#{@users.total_count})
46
        .panel-head-actions
Valery Sizov committed
47
          .dropdown.inline
48
            %a.dropdown-toggle.btn.btn-sm{href: '#', "data-toggle" => "dropdown"}
Valery Sizov committed
49 50
              %span.light sort:
              - if @sort.present?
51
                = sort_options_hash[@sort]
Valery Sizov committed
52
              - else
53
                = sort_title_name
Valery Sizov committed
54 55 56
              %b.caret
            %ul.dropdown-menu
              %li
57
                = link_to admin_users_path(sort: sort_value_name, filter: params[:filter]) do
58
                  = sort_title_name
59
                = link_to admin_users_path(sort: sort_value_recently_signin, filter: params[:filter]) do
60
                  = sort_title_recently_signin
61
                = link_to admin_users_path(sort: sort_value_oldest_signin, filter: params[:filter]) do
62
                  = sort_title_oldest_signin
63
                = link_to admin_users_path(sort: sort_value_recently_created, filter: params[:filter]) do
64
                  = sort_title_recently_created
65
                = link_to admin_users_path(sort: sort_value_oldest_created, filter: params[:filter]) do
66
                  = sort_title_oldest_created
67
                = link_to admin_users_path(sort: sort_value_recently_updated, filter: params[:filter]) do
68
                  = sort_title_recently_updated
69
                = link_to admin_users_path(sort: sort_value_oldest_updated, filter: params[:filter]) do
70
                  = sort_title_oldest_updated
71

72
          = link_to 'New User', new_admin_user_path, class: "btn btn-new btn-sm"
73
      %ul.well-list
74
        - @users.each do |user|
75
          %li
76 77
            .list-item-name
              - if user.blocked?
78
                %i.fa.fa-lock.cred
79
              - else
80
                %i.fa.fa-user.cgreen
81 82 83 84 85
              = link_to user.name, [:admin, user]
              - if user.admin?
                %strong.cred (Admin)
              - if user == current_user
                %span.cred It's you!
86 87
            .pull-right
              %span.light
88
                %i.fa.fa-envelope
89 90
                = mail_to user.email, user.email, class: 'light'
               
91
              = link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: "btn btn-xs"
92
              - unless user == current_user
93
                - if user.blocked?
94
                  = link_to 'Unblock', unblock_admin_user_path(user), method: :put, class: "btn btn-xs btn-success"
95
                - else
96
                  = link_to 'Block', block_admin_user_path(user), data: {confirm: 'USER WILL BE BLOCKED! Are you sure?'}, method: :put, class: "btn btn-xs btn-warning"
97 98
                - if user.access_locked?
                  = link_to 'Unlock', unlock_admin_user_path(user), method: :put, class: "btn btn-xs btn-success", data: { confirm: 'Are you sure?' }
99
                - if user.can_be_removed?
100
                  = 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 btn-xs btn-remove"
101
    = paginate @users, theme: "gitlab"