mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-27 05:19:31 +00:00
Added an button to hide the sidebar.
Feature wished by Mr.AtiX. That way you can view tables in full screen.
This commit is contained in:
parent
1301459718
commit
7f6c9b614f
3 changed files with 65 additions and 0 deletions
|
|
@ -304,6 +304,49 @@ $(document).on("ajaxUI:reload ajaxUI:start", function () {
|
|||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* Register the button which is used to
|
||||
*/
|
||||
$(document).on("ajaxUI:start", function() {
|
||||
let $sidebar = $("#fixed-sidebar");
|
||||
let $container = $("#main");
|
||||
let $toggler = $('#sidebar-toggle-button');
|
||||
|
||||
function sidebarHide() {
|
||||
$sidebar.hide();
|
||||
$container.removeClass('col-md-9 col-lg-10 offset-md-3 offset-lg-2');
|
||||
$container.addClass('col-12');
|
||||
$toggler.html('<i class="fas fa-angle-right"></i>');
|
||||
$toggler.data('hidden', true);
|
||||
localStorage.setItem('sidebarHidden', 'true');
|
||||
}
|
||||
function sidebarShow() {
|
||||
let $sidebar = $("#fixed-sidebar");
|
||||
$sidebar.show();
|
||||
let $container = $("#main");
|
||||
$container.removeClass('col-12');
|
||||
$container.addClass('col-md-9 col-lg-10 offset-md-3 offset-lg-2');
|
||||
$toggler.html('<i class="fas fa-angle-left"></i>');
|
||||
$toggler.data('hidden', false);
|
||||
localStorage.setItem('sidebarHidden', 'false');
|
||||
}
|
||||
|
||||
//Make the state persistent over reloads
|
||||
if(localStorage.getItem('sidebarHidden') === 'true') {
|
||||
sidebarHide();
|
||||
}
|
||||
|
||||
//Register handler
|
||||
$toggler.click(function() {
|
||||
if($(this).data('hidden')) {
|
||||
sidebarShow();
|
||||
} else {
|
||||
sidebarHide();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
//Need for proper body padding, with every navbar height
|
||||
$(window).resize(function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue