mirror of
https://github.com/redmine/redmine.git
synced 2025-11-11 07:46:02 +01:00
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
This commit is contained in:
@@ -1045,11 +1045,15 @@ $(function () {
|
||||
|
||||
function inlineAutoComplete(element) {
|
||||
'use strict';
|
||||
// do not attach if Tribute is already initialized
|
||||
if (element.dataset.tribute === 'true') {return;}
|
||||
|
||||
const issuesUrl = element.dataset.issuesUrl;
|
||||
const usersUrl = element.dataset.usersUrl;
|
||||
// do not attach if Tribute is already initialized
|
||||
if (element.dataset.tribute === 'true') {return};
|
||||
|
||||
const getDataSource = function(entity) {
|
||||
const dataSources = JSON.parse(rm.AutoComplete.dataSources);
|
||||
|
||||
return dataSources[entity];
|
||||
}
|
||||
|
||||
const remoteSearch = function(url, cb) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
@@ -1074,7 +1078,7 @@ function inlineAutoComplete(element) {
|
||||
if (event.target.type === 'text' && $(element).attr('autocomplete') != 'off') {
|
||||
$(element).attr('autocomplete', 'off');
|
||||
}
|
||||
remoteSearch(issuesUrl + text, function (issues) {
|
||||
remoteSearch(getDataSource('issues') + text, function (issues) {
|
||||
return cb(issues);
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user