feat: added sidebar visibility class to body for consistent layout across pages

This commit is contained in:
Shivam Mishra 2019-08-22 12:35:19 +05:30
parent 8f733173e2
commit ca6eae5794
2 changed files with 17 additions and 6 deletions

View file

@ -3,7 +3,6 @@ frappe.provide('frappe.views');
frappe.views.BaseList = class BaseList {
constructor(opts) {
Object.assign(this, opts);
this.show_sidebar = JSON.parse(localStorage.show_sidebar || 'true');
}
show() {
@ -200,15 +199,15 @@ frappe.views.BaseList = class BaseList {
}
toggle_side_bar() {
this.show_sidebar = !this.show_sidebar
localStorage.show_sidebar = this.show_sidebar;
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() {
this.list_sidebar.parent.toggleClass('hide', !this.show_sidebar);
cur_list.page.current_view.find('.layout-main-section-wrapper').toggleClass('col-md-10', this.show_sidebar)
cur_list.page.current_view.find('.layout-main-section-wrapper').toggleClass('col-md-12', this.show_sidebar)
let show_sidebar = JSON.parse(localStorage.show_sidebar || 'true');
$(document.body).toggleClass('no-sidebar', !show_sidebar);
}
setup_main_section() {

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 {