Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1903f6ad
Commit
1903f6ad
authored
Jun 21, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
admin area -> search for users
parent
98a45ce6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
0 deletions
+8
-0
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+1
-0
app/models/user.rb
app/models/user.rb
+4
-0
app/views/admin/users/index.html.haml
app/views/admin/users/index.html.haml
+3
-0
No files found.
app/controllers/admin/users_controller.rb
View file @
1903f6ad
...
@@ -6,6 +6,7 @@ class Admin::UsersController < ApplicationController
...
@@ -6,6 +6,7 @@ class Admin::UsersController < ApplicationController
def
index
def
index
@admin_users
=
User
.
scoped
@admin_users
=
User
.
scoped
@admin_users
=
@admin_users
.
filter
(
params
[
:filter
])
@admin_users
=
@admin_users
.
filter
(
params
[
:filter
])
@admin_users
=
@admin_users
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@admin_users
=
@admin_users
.
order
(
"updated_at DESC"
).
page
(
params
[
:page
])
@admin_users
=
@admin_users
.
order
(
"updated_at DESC"
).
page
(
params
[
:page
])
end
end
...
...
app/models/user.rb
View file @
1903f6ad
...
@@ -83,6 +83,10 @@ class User < ActiveRecord::Base
...
@@ -83,6 +83,10 @@ class User < ActiveRecord::Base
)
)
end
end
end
end
def
self
.
search
query
where
(
"name like :query or email like :query"
,
:query
=>
"%
#{
query
}
%"
)
end
end
end
# == Schema Information
# == Schema Information
#
#
...
...
app/views/admin/users/index.html.haml
View file @
1903f6ad
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
=
link_to
'New User'
,
new_admin_user_path
,
:class
=>
"btn small right"
=
link_to
'New User'
,
new_admin_user_path
,
:class
=>
"btn small right"
%br
%br
=
form_tag
admin_users_path
,
:method
=>
:get
do
=
text_field_tag
:name
,
params
[
:name
],
:class
=>
"xlarge"
=
submit_tag
"Search"
,
:class
=>
"btn submit primary"
%ul
.nav.nav-pills
%ul
.nav.nav-pills
%li
{
:class
=>
"#{'active' unless params[:filter]}"
}
%li
{
:class
=>
"#{'active' unless params[:filter]}"
}
=
link_to
"Active"
,
admin_users_path
=
link_to
"Active"
,
admin_users_path
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment