bootstrap typeahead now part of app.js - updated and optimised enabling categories
This commit is contained in:
parent
9389fd9e83
commit
5a9437db37
@ -75,15 +75,25 @@
|
||||
</nav>
|
||||
|
||||
@section('page-scripts')
|
||||
@js('/plugin/bootstrap3-typeahead/js/bootstrap3-typeahead.min.js','bs-typeahead')
|
||||
<style>
|
||||
/* Solid border */
|
||||
div.typeahead.dropdown-menu > .dropdown-header {
|
||||
color: #000000;
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("input[name=q]").typeahead({
|
||||
autoSelect: false,
|
||||
scrollHeight: 10,
|
||||
theme: 'bootstrap4',
|
||||
delay: 500,
|
||||
minLength: 2,
|
||||
items: {{ isset($search_limit) ? $search_limit : 15 }},
|
||||
items: {{ isset($search_limit) ? $search_limit : 100 }},
|
||||
fitToElement: false,
|
||||
selectOnBlur: false,
|
||||
appendTo: "#search_results",
|
||||
source: function (query,process) {
|
||||
search('{{ url("search",['date'=>isset($ido) ? $ido->id : NULL]) }}',query,process);
|
||||
@ -92,7 +102,8 @@
|
||||
matcher: function () { return true; },
|
||||
|
||||
updater: function (item) {
|
||||
window.parent.location.href = '{{ url("/") }}'+users[item];
|
||||
console.log(item.value);
|
||||
window.parent.location.href = item.value;
|
||||
},
|
||||
})
|
||||
.on('keyup keypress', function(event) {
|
||||
@ -126,17 +137,7 @@
|
||||
// if json is null, means no match, won't do again.
|
||||
if(data==null || (data.length===0)) return;
|
||||
|
||||
users = {};
|
||||
userLabels = [];
|
||||
_.each(data,function(item,ix,list) {
|
||||
if (_.includes(users,item.label))
|
||||
item.label = item.label + ' #' + item.value;
|
||||
|
||||
userLabels.push(item.label);
|
||||
users[item.label] = item.value;
|
||||
});
|
||||
|
||||
process(userLabels);
|
||||
process(data);
|
||||
},
|
||||
complete : function() {
|
||||
if (--c == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user