Browse Source

fix Dashboard position and make card layout optional

version-14
Suraj Shetty 3 years ago
parent
commit
07adeac74d
4 changed files with 12 additions and 13 deletions
  1. +3
    -5
      frappe/public/js/frappe/form/dashboard.js
  2. +5
    -4
      frappe/public/js/frappe/form/form.js
  3. +2
    -2
      frappe/public/js/frappe/form/layout.js
  4. +2
    -2
      frappe/public/js/frappe/form/section.js

+ 3
- 5
frappe/public/js/frappe/form/dashboard.js View File

@@ -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();
}



+ 5
- 4
frappe/public/js/frappe/form/form.js View File

@@ -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


+ 2
- 2
frappe/public/js/frappe/form/layout.js View File

@@ -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) {


+ 2
- 2
frappe/public/js/frappe/form/section.js View File

@@ -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…
Cancel
Save