summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-10-24 16:59:15 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-10-24 16:59:15 +0000
commitd967507dcb2021473d5cb4d91449fc7a1fde0d8f (patch)
tree3ca1c1d92f329b04dcf60b912d5b7c70aaefb672 /app/controllers
parentd1b5bc1e82de96dee8c759ad1eff5406edafb65a (diff)
downloadredmine-d967507dcb2021473d5cb4d91449fc7a1fde0d8f.tar.gz
redmine-d967507dcb2021473d5cb4d91449fc7a1fde0d8f.zip
Adds the ability to search for a user on the administration users list.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1945 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/users_controller.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index d2564c2cb..e2ab510fb 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -33,15 +33,19 @@ class UsersController < ApplicationController
sort_update
@status = params[:status] ? params[:status].to_i : 1
- conditions = "status <> 0"
- conditions = ["status=?", @status] unless @status == 0
+ c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
+
+ unless params[:name].blank?
+ name = "%#{params[:name].strip.downcase}%"
+ c << ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ?", name, name, name]
+ end
- @user_count = User.count(:conditions => conditions)
+ @user_count = User.count(:conditions => c.conditions)
@user_pages = Paginator.new self, @user_count,
per_page_option,
params['page']
@users = User.find :all,:order => sort_clause,
- :conditions => conditions,
+ :conditions => c.conditions,
:limit => @user_pages.items_per_page,
:offset => @user_pages.current.offset