sync changes in application.js

This commit is contained in:
Uwe Steinmann 2024-03-30 12:14:55 +01:00
parent 245bfe640a
commit 6b17c35804
2 changed files with 27 additions and 8 deletions

View File

@ -238,19 +238,40 @@ function initMost() {
* actually provided to update the input field, but here we use
* it to set the document location. */
updater: function (item) {
strarr = item.value.split("#");
//console.log(this.$element.data('target'));
target = this.$element.data('target');
$('#'+target).attr('value', strarr[0]);
return strarr[1];
$('#'+target).attr('value', item.id);
return item.value;
},
sorter: function(items) {
return items;
},
/* Set a matcher that allows any returned value */
matcher : function (item) {
return true;
},
highlighter : function (item) {
strarr = item.split("#");
return '<i class="fa fa-folder-o"></i> ' + strarr[1].replace(/</g, '&lt;');
return '<i class="fa fa-folder-o"></i> ' + item.name.replace(/</g, '&lt;') + (typeof(item.path) != 'undefined' ? '<br /><span class="path">' + item.path + '</span>' : '');
},
/* This only works with a modified version of bootstrap typeahead located
* in boostrap-typeahead.js Search for 'render'
* The line
* this.render = this.options.render || this.render
* was added to bootstrap-typeahead.js
* The following function is a copy of the original render function but
* access item.name instead of item
*/
render : function (items) {
var that = this
items = $(items).map(function (i, item) {
i = $(that.options.item).attr('data-value', item.name).attr('data-id', item.id).attr('data-type', item.type);
i./*find('a').*/html(that.highlighter(item))
return i[0]
})
items.first().addClass('active')
this.$menu.html(items)
return this
}
}); /* }}} */
}

View File

@ -261,8 +261,6 @@ function initMost() {
},
highlighter : function (item) {
return '<i class="fa fa-folder-o"></i> ' + item.name.replace(/</g, '&lt;') + (typeof(item.path) != 'undefined' ? '<br /><span class="path">' + item.path + '</span>' : '');
strarr = item.split("#");
return '<i class="fa fa-folder-o"></i> ' + strarr[1].replace(/</g, '&lt;');
},
/* This only works with a modified version of bootstrap typeahead located
* in boostrap-typeahead.js Search for 'render'