fix(minor): keep form dashboard sections expanded by default

This commit is contained in:
Rushabh Mehta 2021-01-14 09:49:44 +05:30
parent bebfc491a4
commit e88b5f6a85
2 changed files with 11 additions and 4 deletions

View file

@ -602,7 +602,7 @@ class Section {
this.df = options || {};
this.make();
if (this.df.title && this.df.collapsible) {
if (this.df.title && this.df.collapsible && localStorage.getItem(options.css_class + '-closed')) {
this.collapse();
}
this.refresh();
@ -657,6 +657,7 @@ class Section {
this.collapse_link = this.head.on("click", () => {
this.collapse();
});
this.set_icon();
this.indicator.show();
}
}
@ -677,9 +678,15 @@ class Section {
this.body.toggleClass("hide", hide);
this.head && this.head.toggleClass("collapsed", hide);
let indicator_icon = hide ? 'down' : 'up-line';
this.set_icon(hide);
this.indicator & this.indicator.html(frappe.utils.icon(indicator_icon, 'sm', 'mb-1'));
// save state for next reload ('' is falsy)
localStorage.setItem(this.df.css_class + '-closed', hide ? '1' : '');
}
set_icon(hide) {
let indicator_icon = hide ? 'down' : 'up-line';
this.indicator && this.indicator.html(frappe.utils.icon(indicator_icon, 'sm', 'mb-1'));
}
is_collapsed() {

View file

@ -24,7 +24,7 @@
color: $text-muted;
margin-left: 10px;
position: relative;
bottom: -1px;
padding: 0px;
}
.collapse-indicator.octicon-chevron-up {