File tree Expand file tree Collapse file tree
frappe/public/js/frappe/list Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ frappe.provide('frappe.views');
33frappe . views . BaseList = class BaseList {
44 constructor ( opts ) {
55 Object . assign ( this , opts ) ;
6+ this . show_sidebar = JSON . parse ( localStorage . show_sidebar || 'true' ) ;
67 }
78
89 show ( ) {
@@ -200,13 +201,26 @@ frappe.views.BaseList = class BaseList {
200201 }
201202
202203 toggle_side_bar ( ) {
203- this . list_sidebar . parent . toggleClass ( 'hide' ) ;
204- this . page . current_view . find ( '.layout-main-section-wrapper' ) . toggleClass ( 'col-md-10 col-md-12' ) ;
204+ this . show_sidebar = ! this . show_sidebar
205+ localStorage . show_sidebar = this . show_sidebar ;
206+ this . list_sidebar . parent . toggle ( this . show_sidebar ) ;
207+ this . set_list_width ( )
208+ }
209+
210+ set_list_width ( ) {
211+ if ( ! this . show_sidebar ) {
212+ cur_list . page . current_view . find ( '.layout-main-section-wrapper' ) . removeClass ( 'col-md-10' )
213+ cur_list . page . current_view . find ( '.layout-main-section-wrapper' ) . addClass ( 'col-md-12' )
214+ } else {
215+ cur_list . page . current_view . find ( '.layout-main-section-wrapper' ) . removeClass ( 'col-md-12' )
216+ cur_list . page . current_view . find ( '.layout-main-section-wrapper' ) . addClass ( 'col-md-10' )
217+ }
205218 }
206219
207220 setup_main_section ( ) {
208221 return frappe . run_serially ( [
209222 this . setup_list_wrapper ,
223+ this . set_list_width ,
210224 this . setup_filter_area ,
211225 this . setup_sort_selector ,
212226 this . setup_result_area ,
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ frappe.views.ListSidebar = class ListSidebar {
2323 this . sidebar = $ ( '<div class="list-sidebar overlay-sidebar hidden-xs hidden-sm"></div>' )
2424 . html ( sidebar_content )
2525 . appendTo ( this . page . sidebar . empty ( ) ) ;
26+ let show_sidebar = JSON . parse ( localStorage . show_sidebar || 'true' ) ;
27+ this . sidebar . toggle ( show_sidebar )
2628
2729 this . setup_reports ( ) ;
2830 this . setup_list_filter ( ) ;
You can’t perform that action at this time.
0 commit comments