Merge pull request #878 from friends-of-the-core/autocomplete-in-more-places
Autocomplete in more places
This commit is contained in:
commit
606c1fdedc
2 changed files with 31 additions and 1 deletions
|
@ -59,6 +59,34 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
})
|
||||
});
|
||||
|
||||
$('#tag_editor,[name="bulk_tags"]').tagit({
|
||||
singleFieldDelimiter: ' ',
|
||||
autocomplete : ({
|
||||
source: function (request, response) {
|
||||
$.ajax({
|
||||
url: base_href + '/api/internal/autocomplete',
|
||||
data: {'s': request.term},
|
||||
dataType : 'json',
|
||||
type : 'GET',
|
||||
success : function (data) {
|
||||
response(
|
||||
$.map(data, function (count, item) {
|
||||
return {
|
||||
label : item + ' ('+count+')',
|
||||
value : item
|
||||
};
|
||||
})
|
||||
);
|
||||
},
|
||||
error : function (request, status, error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
},
|
||||
minLength: 1
|
||||
})
|
||||
});
|
||||
|
||||
$('.ui-autocomplete-input').keydown(function(e) {
|
||||
var keyCode = e.keyCode || e.which;
|
||||
|
||||
|
|
|
@ -55,7 +55,9 @@ class TagEditTheme extends Themelet
|
|||
<td>
|
||||
".($user->can(Permissions::EDIT_IMAGE_TAG) ? "
|
||||
<span class='view'>$h_tag_links</span>
|
||||
<input class='edit autocomplete_tags' type='text' name='tag_edit__tags' value='$h_tags' id='tag_editor' autocomplete='off'>
|
||||
<div class='edit'>
|
||||
<input class='autocomplete_tags' type='text' name='tag_edit__tags' value='$h_tags' id='tag_editor' autocomplete='off'>
|
||||
</div>
|
||||
" : "
|
||||
$h_tag_links
|
||||
")."
|
||||
|
|
Reference in a new issue