`)
+ .appendTo(this.parent);
+
+ if (this.df) {
+ if (this.df.title) {
+ this.make_head();
+ }
+ if (this.df.description) {
+ this.description_wrapper = $(
+ `
`
+ );
+
+ this.wrapper.append(this.description_wrapper);
+ }
+ if (this.df.css_class) {
+ this.wrapper.addClass(this.df.css_class);
+ }
+ if (this.df.hide_border) {
+ this.wrapper.toggleClass("hide-border", true);
+ }
+ }
+
+ this.body = $('
').appendTo(this.wrapper);
+
+ if (this.body_html) {
+ this.body.append(this.body_html);
+ }
+ }
+
+ make_head() {
+ this.head = $(`
+
+ ${__(this.df.title)}
+
+
+ `);
+
+ this.head.appendTo(this.wrapper);
+ this.indicator = this.head.find('.collapse-indicator');
+ this.indicator.hide();
+
+ if (this.df.collapsible) {
+ // show / hide based on status
+ this.collapse_link = this.head.on("click", () => {
+ this.collapse();
+ });
+ this.indicator.show();
+ }
+ }
+
+ refresh() {
+ if (!this.df) return;
+
+ // hide if explicitly hidden
+ let hide = this.df.hidden;
+ this.wrapper.toggle(!hide);
+ }
+
+ collapse(hide) {
+ if (hide === undefined) {
+ hide = !this.body.hasClass("hide");
+ }
+
+ this.body.toggleClass("hide", hide);
+ this.head && this.head.toggleClass("collapsed", hide);
+
+ let indicator_icon = hide ? 'down' : 'up-line';
+
+ this.indicator & this.indicator.html(frappe.utils.icon(indicator_icon, 'sm', 'mb-1'));
+ }
+
+ is_collapsed() {
+ return this.body.hasClass('hide');
+ }
+
+ hide() {
+ this.wrapper.hide();
+ }
+
+ show() {
+ this.wrapper.show();
+ }
+}
\ No newline at end of file
diff --git a/frappe/public/js/frappe/form/form.js b/frappe/public/js/frappe/form/form.js
index efe86ee0f3..77be2f2816 100644
--- a/frappe/public/js/frappe/form/form.js
+++ b/frappe/public/js/frappe/form/form.js
@@ -175,6 +175,7 @@ frappe.ui.form.Form = class FrappeForm {
this.dashboard = new frappe.ui.form.Dashboard({
frm: this,
+ parent: $('
').insertAfter(this.layout.wrapper.find('.form-message'))
});
// workflow state
diff --git a/frappe/public/js/frappe/form/layout.js b/frappe/public/js/frappe/form/layout.js
index ce149e4371..1d0f1f8ffd 100644
--- a/frappe/public/js/frappe/form/layout.js
+++ b/frappe/public/js/frappe/form/layout.js
@@ -127,14 +127,6 @@ frappe.ui.form.Layout = Class.extend({
if (this.no_opening_section()) {
this.fields.unshift({fieldtype: 'Section Break'});
}
-
- this.fields.unshift({
- fieldtype: 'Section Break',
- fieldname: '_form_dashboard',
- cssClass: 'form-dashboard',
- collapsible: 1,
- // hidden: 1
- });
},
replace_field: function(fieldname, df, render) {
@@ -312,10 +304,6 @@ frappe.ui.form.Layout = Class.extend({
collapse = false;
}
- if (df.fieldname === '_form_dashboard') {
- collapse = localStorage.getItem('collapseFormDashboard')==='yes' ? true : false;
- }
-
section.collapse(collapse);
}
}
@@ -587,17 +575,13 @@ frappe.ui.form.Section = Class.extend({
wrapper: this.wrapper
};
- if (this.df.collapsible && this.df.fieldname !== '_form_dashboard') {
- this.collapse(true);
- }
-
this.refresh();
},
make: function() {
if (!this.layout.page) {
this.layout.page = $('
').appendTo(this.layout.wrapper);
}
- let make_card = this.layout.card_layout && this.df.fieldname !== '_form_dashboard';
+ let make_card = this.layout.card_layout;
this.wrapper = $(`
`)
.appendTo(this.layout.page);
this.layout.sections.push(this);
@@ -664,18 +648,12 @@ frappe.ui.form.Section = Class.extend({
hide = !this.body.hasClass("hide");
}
- if (this.df.fieldname==='_form_dashboard') {
- localStorage.setItem('collapseFormDashboard', hide ? 'yes' : 'no');
- }
-
this.body.toggleClass("hide", hide);
this.head.toggleClass("collapsed", hide);
let indicator_icon = hide ? 'down' : 'up-line';
this.indicator & this.indicator.html(frappe.utils.icon(indicator_icon, 'sm', 'mb-1'));
- // this.indicator && this.indicator.toggleClass("octicon-chevron-down", hide);
- // this.indicator && this.indicator.toggleClass("octicon-chevron-up", !hide);
// refresh signature fields
this.fields_list.forEach((f) => {
diff --git a/frappe/public/less/form.less b/frappe/public/less/form.less
index 5aa23d332e..37dae6ea4f 100644
--- a/frappe/public/less/form.less
+++ b/frappe/public/less/form.less
@@ -123,24 +123,6 @@
}
}
-.progress-area {
- padding-top: 15px;
- padding-bottom: 15px;
-
- .progress-chart {
- padding-top: 15px;
- }
-
- .progress {
- margin-bottom: 5px;
- }
-
- .progress-message {
- font-feature-settings: "tnum" 1;
- margin-top: 0px;
- }
-}
-
.form-section {
margin: 0px;
// padding: 15px;
@@ -173,21 +155,10 @@
}
}
-.hide-border {
- border-top: none !important;
- padding-top: 0px;
-}
-
.empty-section {
display: none !important;
}
-.modal {
- .hide-border {
- padding-top: 0;
- }
-}
-
.help ol {
padding-left: 19px;
}
diff --git a/frappe/public/scss/desk/form.scss b/frappe/public/scss/desk/form.scss
index b9d37d948d..e0895b9073 100644
--- a/frappe/public/scss/desk/form.scss
+++ b/frappe/public/scss/desk/form.scss
@@ -3,11 +3,13 @@
font-size: var(--text-md);
}
-.form-section {
+.form-section, .form-dashboard-section {
margin: 0px;
.form-section-description {
margin-bottom: 10px;
+ font-size: var(--text-xs);
+ color: var(--text-muted);
}
.section-head {
@@ -59,14 +61,11 @@
.section-body:first-child {
margin-top: 0;
}
- .section-head {
- padding-left: 0;
- padding-right: 0;
- }
- .form-dashboard-section {
- padding-left: calc(var(--padding-lg) + var(--padding-xs));
- padding-right: calc(var(--padding-lg) + var(--padding-xs));
- padding-bottom: var(--padding-lg);
+ .form-dashboard-section .section-body {
+ display: block;
+ padding-left: var(--padding-md);
+ padding-right: var(--padding-md);
+ padding-bottom: var(--padding-md);
}
}
@@ -271,3 +270,21 @@
right: 0;
}
}
+
+.progress-area {
+ padding-top: var(--padding-md);
+ padding-bottom: var(--padding-md);
+
+ .progress-chart {
+ padding-top: var(--padding-lg);
+ }
+
+ .progress {
+ margin-bottom: var(--margin-xs);
+ }
+
+ .progress-message {
+ font-feature-settings: "tnum" 1;
+ margin-top: 0px;
+ }
+}
\ No newline at end of file