summaryrefslogtreecommitdiffstats
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-10-25 00:01:14 +0000
committerGo MAEDA <maeda@farend.jp>2020-10-25 00:01:14 +0000
commit74d4d86a14cd683de9a70ffcae6db79344cdef2d (patch)
tree783632f7234cce4156f28e90bc031f5f1a26dd64 /app/helpers/application_helper.rb
parentd57674962ad938b46128fd671133d651f6a78b15 (diff)
downloadredmine-74d4d86a14cd683de9a70ffcae6db79344cdef2d.tar.gz
redmine-74d4d86a14cd683de9a70ffcae6db79344cdef2d.zip
Store inline autocomplete data sources in a JS variable (#34122).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@20191 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 5a0868c2e..dd4a4f195 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1741,6 +1741,22 @@ module ApplicationHelper
end
end
+ def autocomplete_data_sources(project)
+ {
+ issues: auto_complete_issues_path(:project_id => project, :q => '')
+ }
+ end
+
+ def heads_for_auto_complete(project)
+ data_sources = autocomplete_data_sources(project)
+
+ javascript_tag(
+ "rm = window.rm || {};" +
+ "rm.AutoComplete = rm.AutoComplete || {};" +
+ "rm.AutoComplete.dataSources = '#{data_sources.to_json}';"
+ )
+ end
+
private
def wiki_helper