##// END OF EJS Templates
Make sure that tests restore the attachments path to the tmp dir so that fixture files don't get deleted....
Make sure that tests restore the attachments path to the tmp dir so that fixture files don't get deleted. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8248 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r6676:e028e542584f
r8128:ad25e3807d2d
Show More
auto_completes_controller.rb
27 lines | 770 B | text/x-ruby | RubyLexer
/ app / controllers / auto_completes_controller.rb
Eric Davis
Refactor: move IssuesController#auto_complete to a new controller. #4382...
r3831 class AutoCompletesController < ApplicationController
before_filter :find_project
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/auto_completes_controller.rb....
r6676
Eric Davis
Refactor: move IssuesController#auto_complete to a new controller. #4382...
r3831 def issues
@issues = []
q = params[:q].to_s
Jean-Philippe Lang
Autocomplete issue relations on subject (#3170)....
r4388 query = (params[:scope] == "all" && Setting.cross_project_issue_relations?) ? Issue : @project.issues
Eric Davis
Refactor: move IssuesController#auto_complete to a new controller. #4382...
r3831 if q.match(/^\d+$/)
Jean-Philippe Lang
Autocomplete issue relations on subject (#3170)....
r4388 @issues << query.visible.find_by_id(q.to_i)
Eric Davis
Refactor: move IssuesController#auto_complete to a new controller. #4382...
r3831 end
unless q.blank?
Jean-Philippe Lang
Autocomplete issue relations on subject (#3170)....
r4388 @issues += query.visible.find(:all, :conditions => ["LOWER(#{Issue.table_name}.subject) LIKE ?", "%#{q.downcase}%"], :limit => 10)
Eric Davis
Refactor: move IssuesController#auto_complete to a new controller. #4382...
r3831 end
Jean-Philippe Lang
Make sure there's no nil result in auto_complete....
r4389 @issues.compact!
Eric Davis
Refactor: move IssuesController#auto_complete to a new controller. #4382...
r3831 render :layout => false
end
private
def find_project
project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
@project = Project.find(project_id)
rescue ActiveRecord::RecordNotFound
render_404
end
end