summaryrefslogtreecommitdiffstats
path: root/app/controllers/auto_completes_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-08-09 16:58:36 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-08-09 16:58:36 +0000
commitf1650b8ff48aec72afd83e17b07eca2b0b7d9b55 (patch)
tree4102180f875b50464c75ae696e3621e56b8a3601 /app/controllers/auto_completes_controller.rb
parentf82a7a35b0e1bebdc190e70e79be3e7f39d24896 (diff)
downloadredmine-f1650b8ff48aec72afd83e17b07eca2b0b7d9b55.tar.gz
redmine-f1650b8ff48aec72afd83e17b07eca2b0b7d9b55.zip
Adds autocomplete to issue field on time logging form.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10182 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/auto_completes_controller.rb')
-rw-r--r--app/controllers/auto_completes_controller.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb
index 1bbcd33f8..f32adace4 100644
--- a/app/controllers/auto_completes_controller.rb
+++ b/app/controllers/auto_completes_controller.rb
@@ -22,7 +22,7 @@ class AutoCompletesController < ApplicationController
@issues = []
q = (params[:q] || params[:term]).to_s.strip
if q.present?
- scope = (params[:scope] == "all" ? Issue : @project.issues).visible
+ scope = (params[:scope] == "all" || @project.nil? ? Issue : @project.issues).visible
if q.match(/^\d+$/)
@issues << scope.find_by_id(q.to_i)
end
@@ -35,7 +35,9 @@ class AutoCompletesController < ApplicationController
private
def find_project
- @project = Project.find(params[:project_id])
+ if params[:project_id].present?
+ @project = Project.find(params[:project_id])
+ end
rescue ActiveRecord::RecordNotFound
render_404
end