Merge pull request #15002 from shariquerik/form-ui-broken-fix
fix: Form UI broken
This commit is contained in:
commit
0f411d93af
4 changed files with 17 additions and 6 deletions
|
|
@ -14,6 +14,7 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
this.progress_area = this.make_section({
|
||||
css_class: 'progress-area',
|
||||
hidden: 1,
|
||||
collapsible: 1,
|
||||
is_dashboard_section: 1,
|
||||
});
|
||||
|
||||
|
|
@ -21,6 +22,7 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
label: __("Overview"),
|
||||
css_class: 'form-heatmap',
|
||||
hidden: 1,
|
||||
collapsible: 1,
|
||||
is_dashboard_section: 1,
|
||||
body_html: `
|
||||
<div id="heatmap-${frappe.model.scrub(this.frm.doctype)}" class="heatmap"></div>
|
||||
|
|
@ -32,6 +34,7 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
label: __("Graph"),
|
||||
css_class: 'form-graph',
|
||||
hidden: 1,
|
||||
collapsible: 1,
|
||||
is_dashboard_section: 1
|
||||
});
|
||||
|
||||
|
|
@ -40,6 +43,7 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
label: __("Stats"),
|
||||
css_class: 'form-stats',
|
||||
hidden: 1,
|
||||
collapsible: 1,
|
||||
is_dashboard_section: 1,
|
||||
body_html: this.stats_area_row
|
||||
});
|
||||
|
|
@ -50,6 +54,7 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
label: __("Connections"),
|
||||
css_class: 'form-links',
|
||||
hidden: 1,
|
||||
collapsible: 1,
|
||||
is_dashboard_section: 1,
|
||||
body_html: this.transactions_area
|
||||
});
|
||||
|
|
@ -84,9 +89,10 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
hidden,
|
||||
body_html,
|
||||
make_card: true,
|
||||
collapsible: 1,
|
||||
is_dashboard_section: 1
|
||||
};
|
||||
return new Section(this.frm.layout.wrapper, options).body;
|
||||
return new Section(this.parent, options).body;
|
||||
}
|
||||
|
||||
add_progress(title, percent, message) {
|
||||
|
|
@ -203,7 +209,7 @@ frappe.ui.form.Dashboard = class FormDashboard {
|
|||
after_refresh() {
|
||||
// show / hide new buttons (if allowed)
|
||||
this.links_area.body.find('.btn-new').each((i, el) => {
|
||||
if (this.frm.can_create($(this).attr('data-doctype'))) {
|
||||
if (this.frm.can_create($(el).attr('data-doctype'))) {
|
||||
$(el).removeClass('hidden');
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -156,8 +156,11 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
|
||||
let dashboard_parent = $('<div class="form-dashboard">');
|
||||
|
||||
let main_page = this.layout.tabs.length ? this.layout.tabs[0].wrapper : this.layout.wrapper;
|
||||
main_page.prepend(dashboard_parent);
|
||||
if (this.layout.tabs.length) {
|
||||
this.layout.tabs[0].wrapper.prepend(dashboard_parent);
|
||||
} else {
|
||||
dashboard_parent.insertAfter(this.layout.wrapper.find('.form-message'));
|
||||
}
|
||||
this.dashboard = new frappe.ui.form.Dashboard(dashboard_parent, this);
|
||||
|
||||
this.tour = new frappe.ui.form.FormTour({
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ frappe.ui.form.Layout = class Layout {
|
|||
}
|
||||
|
||||
make_section(df) {
|
||||
this.section = new Section(this.current_tab ? this.current_tab.wrapper : this.page, df, this.card_layout);
|
||||
this.section = new Section(this.current_tab ? this.current_tab.wrapper : this.page, df, this.card_layout, this);
|
||||
|
||||
// append to layout fields
|
||||
if (df) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
export default class Section {
|
||||
constructor(parent, df, card_layout) {
|
||||
constructor(parent, df, card_layout, layout) {
|
||||
this.layout = layout;
|
||||
this.card_layout = card_layout;
|
||||
this.parent = parent;
|
||||
this.df = df || {};
|
||||
|
|
@ -25,6 +26,7 @@ export default class Section {
|
|||
${this.df.is_dashboard_section ? "form-dashboard-section" : "form-section"}
|
||||
${ make_card ? "card-section" : "" }">
|
||||
`).appendTo(this.parent);
|
||||
this.layout && this.layout.sections.push(this);
|
||||
|
||||
if (this.df) {
|
||||
if (this.df.label) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue