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
resources/themes/adminlte/views/layouts/partials

View File

@ -7,7 +7,7 @@
<small>@yield('contentheader_description','Description')</small>
</div><!-- /.col -->
<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>
@isset($breadcrumb)
@foreach ($breadcrumb as $item => $url)

View File

@ -18,6 +18,8 @@
<i class="fa fa-search"></i>
</button>
</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>
</form>
@ -95,14 +97,15 @@
type : 'GET',
data : 'term=' + query,
dataType : 'JSON',
async : false,
async : true,
cache : false,
beforeSend : function() {
if (c++ == 0) {
if (icon)
$('i[name='+icon+']').addClass("fa-spin");
else
$('i[name=searching]').removeClass("hidden");
else {
$('span[name=searching]').removeClass("d-none");
}
}
},
success : function(data) {
@ -125,8 +128,9 @@
if (--c == 0) {
if (icon)
$('i[name='+icon+']').removeClass("fa-spin");
else
$('i[name=searching]').addClass("hidden");
else {
$('span[name=searching]').addClass("d-none");
}
}
}
})

View File

@ -13,4 +13,43 @@
'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>