BigW Consortium Gitlab

index.html.haml 3.95 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 16 17 18 19 20 21 22 23 24
    .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
        %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
25 26 27
      = 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'
28
        = button_tag class: 'btn btn-primary' do
29
          %i.fa.fa-search
30
      %hr
31
      = link_to 'Reset', admin_users_path, class: "btn btn-cancel"
32

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

63
          = link_to 'New User', new_admin_user_path, class: "btn btn-new btn-sm"
64
      %ul.well-list
65
        - @users.each do |user|
66
          %li
67 68
            .list-item-name
              - if user.blocked?
69
                %i.fa.fa-lock.cred
70
              - else
71
                %i.fa.fa-user.cgreen
72 73 74 75 76
              = link_to user.name, [:admin, user]
              - if user.admin?
                %strong.cred (Admin)
              - if user == current_user
                %span.cred It's you!
77 78
            .pull-right
              %span.light
79
                %i.fa.fa-envelope
80 81
                = mail_to user.email, user.email, class: 'light'
               
Dmitriy Zaporozhets committed
82
              = link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: "btn btn-sm"
83
              - unless user == current_user
84
                - if user.blocked?
Dmitriy Zaporozhets committed
85
                  = link_to 'Unblock', unblock_admin_user_path(user), method: :put, class: "btn btn-sm success"
86
                - else
Dmitriy Zaporozhets committed
87 88
                  = link_to 'Block', block_admin_user_path(user), data: {confirm: 'USER WILL BE BLOCKED! Are you sure?'}, method: :put, class: "btn btn-sm btn-remove"
                = link_to 'Destroy', [:admin, user], data: { confirm: "USER #{user.name} WILL BE REMOVED! All tickets linked to this user will also be removed! Maybe block the user instead? Are you sure?" }, method: :delete, class: "btn btn-sm btn-remove"
89
    = paginate @users, theme: "gitlab"