##// END OF EJS Templates
remove trailing white-spaces from app/controllers/auto_completes_controller.rb....
Toshi MARUYAMA -
r6676:e028e542584f
parent child
Show More
@@ -1,27 +1,27
1 class AutoCompletesController < ApplicationController
1 class AutoCompletesController < ApplicationController
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 query = (params[:scope] == "all" && Setting.cross_project_issue_relations?) ? Issue : @project.issues
8 if q.match(/^\d+$/)
8 if q.match(/^\d+$/)
9 @issues << query.visible.find_by_id(q.to_i)
9 @issues << query.visible.find_by_id(q.to_i)
10 end
10 end
11 unless q.blank?
11 unless q.blank?
12 @issues += query.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)
13 end
13 end
14 @issues.compact!
14 @issues.compact!
15 render :layout => false
15 render :layout => false
16 end
16 end
17
17
18 private
18 private
19
19
20 def find_project
20 def find_project
21 project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
21 project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
22 @project = Project.find(project_id)
22 @project = Project.find(project_id)
23 rescue ActiveRecord::RecordNotFound
23 rescue ActiveRecord::RecordNotFound
24 render_404
24 render_404
25 end
25 end
26
26
27 end
27 end
General Comments 0
You need to be logged in to leave comments. Login now