Merge pull request #8227 from scmmishra/sidebar-toggle

feat: allow toggle sidebar to be persistent using local storage
This commit is contained in:
sahil28297 2019-08-23 13:59:07 +05:30 committed by GitHub
commit 266aa83741
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 2 deletions

View file

@ -199,13 +199,21 @@ frappe.views.BaseList = class BaseList {
}
toggle_side_bar() {
this.list_sidebar.parent.toggleClass('hide');
this.page.current_view.find('.layout-main-section-wrapper').toggleClass('col-md-10 col-md-12');
let show_sidebar = JSON.parse(localStorage.show_sidebar || 'true');
show_sidebar = !show_sidebar;
localStorage.show_sidebar = show_sidebar;
this.show_or_hide_sidebar();
}
show_or_hide_sidebar() {
let show_sidebar = JSON.parse(localStorage.show_sidebar || 'true');
$(document.body).toggleClass('no-sidebar', !show_sidebar);
}
setup_main_section() {
return frappe.run_serially([
this.setup_list_wrapper,
this.show_or_hide_sidebar,
this.setup_filter_area,
this.setup_sort_selector,
this.setup_result_area,

View file

@ -1081,6 +1081,18 @@ body.full-width {
}
}
body.no-sidebar {
@media (min-width: @screen-md) {
.layout-side-section {
display: none;
}
.layout-main-section-wrapper {
width: 100% !important;
}
}
}
// utilities
.whitespace-nowrap {