From 74d4d86a14cd683de9a70ffcae6db79344cdef2d Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 25 Oct 2020 00:01:14 +0000 Subject: 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 --- app/helpers/application_helper.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/helpers/application_helper.rb') 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 -- cgit v1.2.3