fix Dashboard position and make card layout optional
This commit is contained in:
parent
713acd7b24
commit
07adeac74d
4 changed files with 12 additions and 13 deletions
|
|
@ -4,11 +4,9 @@
|
|||
import Section from "./section.js";
|
||||
|
||||
frappe.ui.form.Dashboard = class FormDashboard {
|
||||
constructor(opts) {
|
||||
$.extend(this, opts);
|
||||
let parent = this.tab ? this.tab.wrapper : this.frm.layout.wrapper;
|
||||
this.parent = $('<div class="form-dashboard">');
|
||||
parent.prepend(this.parent);
|
||||
constructor(parent, frm) {
|
||||
this.parent = parent;
|
||||
this.frm = frm;
|
||||
this.setup_dashboard_sections();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,10 +154,11 @@ frappe.ui.form.Form = class FrappeForm {
|
|||
this.fields_dict = this.layout.fields_dict;
|
||||
this.fields = this.layout.fields_list;
|
||||
|
||||
this.dashboard = new frappe.ui.form.Dashboard({
|
||||
frm: this,
|
||||
tab: this.layout.tabs.length ? this.layout.tabs[0] : null
|
||||
});
|
||||
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);
|
||||
this.dashboard = new frappe.ui.form.Dashboard(dashboard_parent, this);
|
||||
|
||||
this.tour = new frappe.ui.form.FormTour({
|
||||
frm: this
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ frappe.ui.form.Layout = class Layout {
|
|||
}
|
||||
|
||||
if (this.is_tabbed_layout()) {
|
||||
let default_tab = {label: __('Details'), fieldname: 'details'};
|
||||
let default_tab = {label: __('Details'), fieldname: 'details', fieldtype: "Tab Break"};
|
||||
let first_tab = this.fields[1].fieldtype === "Tab Break" ? this.fields[1] : null;
|
||||
if (!first_tab) {
|
||||
this.fields.splice(1, 0, default_tab);
|
||||
|
|
@ -240,7 +240,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.section = new Section(this.current_tab ? this.current_tab.wrapper : this.page, df, this.card_layout);
|
||||
|
||||
// append to layout fields
|
||||
if (df) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
export default class Section {
|
||||
constructor(parent, df) {
|
||||
this.card_layout = true;
|
||||
constructor(parent, df, card_layout) {
|
||||
this.card_layout = card_layout;
|
||||
this.parent = parent;
|
||||
this.df = df || {};
|
||||
this.fields_list = [];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue