Merge pull request #8227 from scmmishra/sidebar-toggle
feat: allow toggle sidebar to be persistent using local storage
This commit is contained in:
commit
266aa83741
2 changed files with 22 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue