Use session storage for sidebar state
The sidebar state is now maintained per tab/window because users view different things in different tabs/windows. E.g. users work with a specific module constantly clicking through the menu while having other tabs/windows with some important dashboards open. When the sidebar is closed in one tab/widnow, it should not close the sidebar in the other tabs/windows.
This commit is contained in:
parent
a1a18feb04
commit
62d4e73d5a
|
@ -38,22 +38,12 @@
|
|||
*/
|
||||
this.storage = Icinga.Storage.BehaviorStorage('navigation');
|
||||
|
||||
this.storage.setBackend(window.sessionStorage);
|
||||
|
||||
// Restore collapsed sidebar if necessary
|
||||
if (this.storage.get('sidebar-collapsed')) {
|
||||
$('#layout').addClass('sidebar-collapsed');
|
||||
}
|
||||
|
||||
// Ensure we'll get notified if the sidebar is toggled in another window
|
||||
this.storage.onChange('sidebar-collapsed', function (collapsed) {
|
||||
// Not using toggleClass here to avoid inconsistencies
|
||||
if (collapsed) {
|
||||
$('#layout').addClass('sidebar-collapsed');
|
||||
} else {
|
||||
$('#layout').removeClass('sidebar-collapsed');
|
||||
}
|
||||
|
||||
$(window).trigger('resize');
|
||||
}, this);
|
||||
};
|
||||
|
||||
Navigation.prototype = new Icinga.EventListener();
|
||||
|
|
Loading…
Reference in New Issue