style admin -> users page. Search by username too
This commit is contained in:
parent
fd5dc597ed
commit
6b24c375cb
|
@ -138,7 +138,7 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def search query
|
def search query
|
||||||
where("name LIKE :query or email LIKE :query", query: "%#{query}%")
|
where("name LIKE :query OR email LIKE :query OR username LIKE :query", query: "%#{query}%")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,56 +3,60 @@
|
||||||
= link_to 'New User', new_admin_user_path, class: "btn btn-small pull-right"
|
= link_to 'New User', new_admin_user_path, class: "btn btn-small pull-right"
|
||||||
%br
|
%br
|
||||||
|
|
||||||
= form_tag admin_users_path, method: :get, class: 'form-inline' do
|
.row
|
||||||
= text_field_tag :name, params[:name], class: "xlarge"
|
.span3
|
||||||
= submit_tag "Search", class: "btn submit btn-primary"
|
.admin-filter
|
||||||
%ul.nav.nav-tabs
|
= form_tag admin_users_path, method: :get, class: 'form-inline' do
|
||||||
|
= search_field_tag :name, params[:name], placeholder: 'Name, email or username', class: 'search-text-input span2'
|
||||||
|
= button_tag type: 'submit', class: 'btn' do
|
||||||
|
%i.icon-search
|
||||||
|
%ul.nav.nav-pills.nav-stacked
|
||||||
%li{class: "#{'active' unless params[:filter]}"}
|
%li{class: "#{'active' unless params[:filter]}"}
|
||||||
= link_to admin_users_path do
|
= link_to admin_users_path do
|
||||||
Active
|
Active
|
||||||
%span.badge= User.active.count
|
%small.pull-right= User.active.count
|
||||||
%li{class: "#{'active' if params[:filter] == "admins"}"}
|
%li{class: "#{'active' if params[:filter] == "admins"}"}
|
||||||
= link_to admin_users_path(filter: "admins") do
|
= link_to admin_users_path(filter: "admins") do
|
||||||
Admins
|
Admins
|
||||||
%span.badge= User.admins.count
|
%small.pull-right= User.admins.count
|
||||||
%li{class: "#{'active' if params[:filter] == "blocked"}"}
|
%li{class: "#{'active' if params[:filter] == "blocked"}"}
|
||||||
= link_to admin_users_path(filter: "blocked") do
|
= link_to admin_users_path(filter: "blocked") do
|
||||||
Blocked
|
Blocked
|
||||||
%span.badge= User.blocked.count
|
%small.pull-right= User.blocked.count
|
||||||
%li{class: "#{'active' if params[:filter] == "wop"}"}
|
%li{class: "#{'active' if params[:filter] == "wop"}"}
|
||||||
= link_to admin_users_path(filter: "wop") do
|
= link_to admin_users_path(filter: "wop") do
|
||||||
Without projects
|
Without projects
|
||||||
%span.badge= User.without_projects.count
|
%small.pull-right= User.without_projects.count
|
||||||
|
%hr
|
||||||
%table
|
= link_to 'Reset', admin_users_path, class: "btn btn-cancel"
|
||||||
%thead
|
|
||||||
%tr
|
|
||||||
%th Admin
|
|
||||||
%th
|
|
||||||
Name
|
|
||||||
%i.icon-sort-down
|
|
||||||
%th Username
|
|
||||||
%th Email
|
|
||||||
%th Projects
|
|
||||||
%th Edit
|
|
||||||
%th.cred Danger Zone!
|
|
||||||
|
|
||||||
|
.span9
|
||||||
|
.ui-box
|
||||||
|
%h5.title
|
||||||
|
Users (#{@admin_users.total_count})
|
||||||
|
%ul.well-list
|
||||||
- @admin_users.each do |user|
|
- @admin_users.each do |user|
|
||||||
%tr
|
%li
|
||||||
%td= check_box_tag "admin", 1, user.admin, disabled: :disabled
|
- if user.blocked?
|
||||||
%td= link_to user.name, [:admin, user]
|
%i.icon-lock.cred
|
||||||
%td= user.username
|
- else
|
||||||
%td= user.email
|
%i.icon-user.cgreen
|
||||||
%td= user.users_projects.count
|
= link_to user.name, [:admin, user]
|
||||||
%td= link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: "btn btn-small"
|
- if user.admin?
|
||||||
%td.bgred
|
%strong.cred (Admin)
|
||||||
- if user == current_user
|
- if user == current_user
|
||||||
%span.cred It's you!
|
%span.cred It's you!
|
||||||
- else
|
.pull-right
|
||||||
|
%span.light
|
||||||
|
%i.icon-envelope
|
||||||
|
= mail_to user.email, user.email, class: 'light'
|
||||||
|
|
||||||
|
= link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: "btn btn-small"
|
||||||
|
- unless user == current_user
|
||||||
- if user.blocked
|
- if user.blocked
|
||||||
= link_to 'Unblock', unblock_admin_user_path(user), method: :put, class: "btn btn-small success"
|
= link_to 'Unblock', unblock_admin_user_path(user), method: :put, class: "btn btn-small success"
|
||||||
- else
|
- else
|
||||||
= link_to 'Block', block_admin_user_path(user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove"
|
= link_to 'Block', block_admin_user_path(user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove"
|
||||||
= link_to 'Destroy', [:admin, user], confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn btn-small btn-remove"
|
= link_to 'Destroy', [:admin, user], confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn btn-small btn-remove"
|
||||||
|
%li.bottom
|
||||||
= paginate @admin_users, theme: "admin"
|
= paginate @admin_users, theme: "gitlab"
|
||||||
|
|
Loading…
Reference in a new issue