summaryrefslogtreecommitdiffstats
path: root/app/controllers/admin_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-10-24 17:12:39 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-10-24 17:12:39 +0000
commit16eda4c5c91c55a09eec7a1d04b9db98aeb4ece5 (patch)
tree5e613765f4d5e5f9883a227abddd7db2397b66eb /app/controllers/admin_controller.rb
parentb4101c8b65ecab179a3af492023d95a20d4bc388 (diff)
downloadredmine-16eda4c5c91c55a09eec7a1d04b9db98aeb4ece5.tar.gz
redmine-16eda4c5c91c55a09eec7a1d04b9db98aeb4ece5.zip
Adds the ability to search for a project name or identifier on the administration projects list.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1947 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/admin_controller.rb')
-rw-r--r--app/controllers/admin_controller.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index a6df49dcd..777c31d70 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -29,16 +29,20 @@ class AdminController < ApplicationController
sort_init 'name', 'asc'
sort_update
- @status = params[:status] ? params[:status].to_i : 0
- conditions = nil
- conditions = ["status=?", @status] unless @status == 0
+ @status = params[:status] ? params[:status].to_i : 1
+ c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status])
- @project_count = Project.count(:conditions => conditions)
+ unless params[:name].blank?
+ name = "%#{params[:name].strip.downcase}%"
+ c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name]
+ end
+
+ @project_count = Project.count(:conditions => c.conditions)
@project_pages = Paginator.new self, @project_count,
per_page_option,
params['page']
@projects = Project.find :all, :order => sort_clause,
- :conditions => conditions,
+ :conditions => c.conditions,
:limit => @project_pages.items_per_page,
:offset => @project_pages.current.offset