search function improved
This commit is contained in:
parent
1d5b686619
commit
a4fc00aa63
|
@ -226,8 +226,6 @@ function table($type) {
|
||||||
$("#search").autoComplete({
|
$("#search").autoComplete({
|
||||||
minChars: 3,
|
minChars: 3,
|
||||||
source: function(term, response) {
|
source: function(term, response) {
|
||||||
console.log(term);
|
|
||||||
// Prevent call inmediatly another ajax request
|
|
||||||
try { searchXHR.abort(); } catch(e){}
|
try { searchXHR.abort(); } catch(e){}
|
||||||
searchXHR = $.getJSON(HTML_PATH_ADMIN_ROOT+"ajax/content-list",
|
searchXHR = $.getJSON(HTML_PATH_ADMIN_ROOT+"ajax/content-list",
|
||||||
{
|
{
|
||||||
|
@ -247,9 +245,13 @@ function table($type) {
|
||||||
response(matches);
|
response(matches);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onSelect: function(e, term, item) {
|
renderItem: function (item, search) {
|
||||||
var key = searchList[term];
|
var key = searchList[item];
|
||||||
window.open("<?php echo DOMAIN_ADMIN ?>edit-content/"+key,"_self");
|
html = '<div class="search-suggestion">';
|
||||||
|
html += '<div class="search-suggestion-item">'+item+'</div>';
|
||||||
|
html += '<div class="search-suggestion-options"><a href="<?php echo DOMAIN_ADMIN ?>edit-content/'+key+'">Edit</a> <a target="_blank" class="ml-2" href="<?php echo DOMAIN_PAGES ?>'+key+'"">Visit</a></div>';
|
||||||
|
html += '</div>';
|
||||||
|
return html;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue