index.html.haml 4.05 KB
Newer Older
1
- @no_container = true
2
- page_title "Users"
3
= render "admin/dashboard/head"
4

Valery Sizov's avatar
Valery Sizov committed
5
%div{ class: container_class }
6 7 8 9 10 11 12
  .top-area
    .prepend-top-default
      = form_tag admin_users_path, method: :get do
        - if params[:filter].present?
          = hidden_field_tag "filter", h(params[:filter])
        .search-holder
          .search-field-holder
13
            = search_field_tag :search_query, params[:search_query], placeholder: 'Search by name, email or username', class: 'form-control search-text-input js-search-input', spellcheck: false
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
            = icon("search", class: "search-icon")
          .dropdown
            - toggle_text = if @sort.present? then sort_options_hash[@sort] else sort_title_name end
            = dropdown_toggle(toggle_text, { toggle: 'dropdown' })
            %ul.dropdown-menu.dropdown-menu-align-right
              %li.dropdown-header
                Sort by
              %li
                = 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
36
          = link_to 'New user', new_admin_user_path, class: 'btn btn-new btn-search'
37

38 39 40
    .nav-block
      %ul.nav-links.wide.scrolling-tabs.white.scrolling-tabs
        .fade-left
Semyon Pupkov's avatar
Semyon Pupkov committed
41
        = nav_link(html_options: { class: active_when(params[:filter].nil?) }) do
42 43 44
          = link_to admin_users_path do
            Active
            %small.badge= number_with_delimiter(User.active.count)
Semyon Pupkov's avatar
Semyon Pupkov committed
45
        = nav_link(html_options: { class: active_when(params[:filter] == 'admins') }) do
46 47 48
          = link_to admin_users_path(filter: "admins") do
            Admins
            %small.badge= number_with_delimiter(User.admins.count)
Semyon Pupkov's avatar
Semyon Pupkov committed
49
        = nav_link(html_options: { class: "#{active_when(params[:filter] == 'two_factor_enabled')} filter-two-factor-enabled" }) do
50 51 52
          = link_to admin_users_path(filter: 'two_factor_enabled') do
            2FA Enabled
            %small.badge= number_with_delimiter(User.with_two_factor.count)
Semyon Pupkov's avatar
Semyon Pupkov committed
53
        = nav_link(html_options: { class: "#{active_when(params[:filter] == 'two_factor_disabled')} filter-two-factor-disabled" }) do
54 55 56
          = link_to admin_users_path(filter: 'two_factor_disabled') do
            2FA Disabled
            %small.badge= number_with_delimiter(User.without_two_factor.count)
Semyon Pupkov's avatar
Semyon Pupkov committed
57
        = nav_link(html_options: { class: active_when(params[:filter] == 'external') }) do
58 59 60
          = link_to admin_users_path(filter: 'external') do
            External
            %small.badge= number_with_delimiter(User.external.count)
Semyon Pupkov's avatar
Semyon Pupkov committed
61
        = nav_link(html_options: { class: active_when(params[:filter] == 'blocked') }) do
62 63 64
          = link_to admin_users_path(filter: "blocked") do
            Blocked
            %small.badge= number_with_delimiter(User.blocked.count)
Semyon Pupkov's avatar
Semyon Pupkov committed
65
        = nav_link(html_options: { class: active_when(params[:filter] == 'wop') }) do
66 67 68 69
          = link_to admin_users_path(filter: "wop") do
            Without projects
            %small.badge= number_with_delimiter(User.without_projects.count)
        .fade-right
70

Annabel Dunstone Gray's avatar
Annabel Dunstone Gray committed
71
  %ul.flex-list.content-list
72 73 74 75 76
    - if @users.empty?
      %li
        .nothing-here-block No users found.
    - else
      = render partial: 'admin/users/user', collection: @users
77

78
  = paginate @users, theme: "gitlab"