diff options
author | Go MAEDA <maeda@farend.jp> | 2020-10-25 00:01:14 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-10-25 00:01:14 +0000 |
commit | 74d4d86a14cd683de9a70ffcae6db79344cdef2d (patch) | |
tree | 783632f7234cce4156f28e90bc031f5f1a26dd64 /app/helpers | |
parent | d57674962ad938b46128fd671133d651f6a78b15 (diff) | |
download | redmine-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')
-rw-r--r-- | app/helpers/application_helper.rb | 16 | ||||
-rw-r--r-- | app/helpers/custom_fields_helper.rb | 8 |
2 files changed, 19 insertions, 5 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 diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index 1e0c1b07e..41b20c46a 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -84,9 +84,8 @@ module CustomFieldsHelper if custom_value.custom_field.full_text_formatting? css += ' wiki-edit' data = { - :auto_complete => true, - :issues_url => auto_complete_issues_path(:project_id => custom_value.customized.project, :q => '') - } if custom_value.customized&.try(:project) + :auto_complete => true + } end custom_value.custom_field.format.edit_tag( self, @@ -133,8 +132,7 @@ module CustomFieldsHelper if custom_field.full_text_formatting? css += ' wiki-edit' data = { - :auto_complete => true, - :issues_url => auto_complete_issues_path(:q => '') + :auto_complete => true } end custom_field.format.bulk_edit_tag( |