Enabled search results and remember sidebar collapse

This commit is contained in:
Deon George 2019-02-18 20:44:17 +11:00
parent 062b1bce8c
commit 91aa1d9378
3 changed files with 49 additions and 6 deletions

View File

@ -7,7 +7,7 @@
<small>@yield('contentheader_description','Description')</small> <small>@yield('contentheader_description','Description')</small>
</div><!-- /.col --> </div><!-- /.col -->
<div class="col-sm-6"> <div class="col-sm-6">
<ol class="breadcrumb float-sm-right"> <ol class="breadcrumb float-sm-right small">
<li class="breadcrumb-item"><a href="{{ url('/home'.(isset($ido) ? '/'.$ido->id : '')) }}">Home</a></li> <li class="breadcrumb-item"><a href="{{ url('/home'.(isset($ido) ? '/'.$ido->id : '')) }}">Home</a></li>
@isset($breadcrumb) @isset($breadcrumb)
@foreach ($breadcrumb as $item => $url) @foreach ($breadcrumb as $item => $url)

View File

@ -18,6 +18,8 @@
<i class="fa fa-search"></i> <i class="fa fa-search"></i>
</button> </button>
</div> </div>
<span name="searching" class="d-none"><i class="fa fa-spinner fa-spin fa-fw" style="margin-top: .33em; width: 1em; height: 1em;"></i></span>
<div id="search_results"></div>
</div> </div>
</form> </form>
@ -95,14 +97,15 @@
type : 'GET', type : 'GET',
data : 'term=' + query, data : 'term=' + query,
dataType : 'JSON', dataType : 'JSON',
async : false, async : true,
cache : false, cache : false,
beforeSend : function() { beforeSend : function() {
if (c++ == 0) { if (c++ == 0) {
if (icon) if (icon)
$('i[name='+icon+']').addClass("fa-spin"); $('i[name='+icon+']').addClass("fa-spin");
else else {
$('i[name=searching]').removeClass("hidden"); $('span[name=searching]').removeClass("d-none");
}
} }
}, },
success : function(data) { success : function(data) {
@ -125,8 +128,9 @@
if (--c == 0) { if (--c == 0) {
if (icon) if (icon)
$('i[name='+icon+']').removeClass("fa-spin"); $('i[name='+icon+']').removeClass("fa-spin");
else else {
$('i[name=searching]').addClass("hidden"); $('span[name=searching]').addClass("d-none");
}
} }
} }
}) })

View File

@ -13,4 +13,43 @@
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
} }
}); });
$.AdminLTESidebarTweak = {};
$.AdminLTESidebarTweak.options = {
EnableRemember: true,
//Removes the transition after page reload.
NoTransitionAfterReload: false
};
$(function () {
"use strict";
$("body").on("collapsed.lte.pushmenu", function(){
if($.AdminLTESidebarTweak.options.EnableRemember){
document.cookie = "toggleState=closed";
}
});
$("body").on("expanded.lte.pushmenu", function(){
if($.AdminLTESidebarTweak.options.EnableRemember){
document.cookie = "toggleState=opened";
}
});
if($.AdminLTESidebarTweak.options.EnableRemember){
var re = new RegExp('toggleState' + "=([^;]+)");
var value = re.exec(document.cookie);
var toggleState = (value != null) ? unescape(value[1]) : null;
if(toggleState == 'closed'){
if($.AdminLTESidebarTweak.options.NoTransitionAfterReload){
$("body").addClass('sidebar-collapse hold-transition').delay(100).queue(function(){
$(this).removeClass('hold-transition');
});
}else{
$("body").addClass('sidebar-collapse');
}
}
}
});
</script> </script>