Mercurial > hg > soundsoftware-site
comparison app/controllers/auto_completes_controller.rb @ 117:af80e5618e9b redmine-1.1
* Update to Redmine 1.1-stable branch (Redmine SVN rev 4707)
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 12:53:21 +0000 |
parents | 1d32c0a0efbf |
children | cbb26bc654de |
comparison
equal
deleted
inserted
replaced
39:150ceac17a8d | 117:af80e5618e9b |
---|---|
2 before_filter :find_project | 2 before_filter :find_project |
3 | 3 |
4 def issues | 4 def issues |
5 @issues = [] | 5 @issues = [] |
6 q = params[:q].to_s | 6 q = params[:q].to_s |
7 query = (params[:scope] == "all" && Setting.cross_project_issue_relations?) ? Issue : @project.issues | |
7 if q.match(/^\d+$/) | 8 if q.match(/^\d+$/) |
8 @issues << @project.issues.visible.find_by_id(q.to_i) | 9 @issues << query.visible.find_by_id(q.to_i) |
9 end | 10 end |
10 unless q.blank? | 11 unless q.blank? |
11 @issues += @project.issues.visible.find(:all, :conditions => ["LOWER(#{Issue.table_name}.subject) LIKE ?", "%#{q.downcase}%"], :limit => 10) | 12 @issues += query.visible.find(:all, :conditions => ["LOWER(#{Issue.table_name}.subject) LIKE ?", "%#{q.downcase}%"], :limit => 10) |
12 end | 13 end |
14 @issues.compact! | |
13 render :layout => false | 15 render :layout => false |
14 end | 16 end |
15 | 17 |
16 private | 18 private |
17 | 19 |