From 7ffb825d6775449ec842f5b66b1eb4d8fbc37765 Mon Sep 17 00:00:00 2001 From: elijah Date: Sun, 7 Jun 2015 23:34:25 -0700 Subject: initial commit --- app/controllers/auto_completes_controller.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 app/controllers/auto_completes_controller.rb (limited to 'app') diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb new file mode 100644 index 0000000..cbecd77 --- /dev/null +++ b/app/controllers/auto_completes_controller.rb @@ -0,0 +1,24 @@ +# +# Override to change the LIMIT. +# Copied from Redmine 2.6 +# + +class AutoCompletesController < ApplicationController + def issues + @issues = [] + q = (params[:q] || params[:term]).to_s.strip + if q.present? + scope = Issue.cross_project_scope(@project, params[:scope]).visible + if q.match(/\A#?(\d+)\z/) + @issues << scope.find_by_id($1.to_i) + end + @issues += scope. + where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%"). + order("#{Issue.table_name}.id DESC"). + limit(100). + all + @issues.compact! + end + render :layout => false + end +end -- cgit v1.2.3