ソースを参照

fix Dashboard position and make card layout optional

version-14
Suraj Shetty 3年前
コミット
07adeac74d
4個のファイルの変更12行の追加13行の削除
  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 ファイルの表示

@@ -4,11 +4,9 @@
import Section from "./section.js"; import Section from "./section.js";


frappe.ui.form.Dashboard = class FormDashboard { 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(); this.setup_dashboard_sections();
} }




+ 5
- 4
frappe/public/js/frappe/form/form.js ファイルの表示

@@ -154,10 +154,11 @@ frappe.ui.form.Form = class FrappeForm {
this.fields_dict = this.layout.fields_dict; this.fields_dict = this.layout.fields_dict;
this.fields = this.layout.fields_list; 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({ this.tour = new frappe.ui.form.FormTour({
frm: this frm: this


+ 2
- 2
frappe/public/js/frappe/form/layout.js ファイルの表示

@@ -122,7 +122,7 @@ frappe.ui.form.Layout = class Layout {
} }


if (this.is_tabbed_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; let first_tab = this.fields[1].fieldtype === "Tab Break" ? this.fields[1] : null;
if (!first_tab) { if (!first_tab) {
this.fields.splice(1, 0, default_tab); this.fields.splice(1, 0, default_tab);
@@ -240,7 +240,7 @@ frappe.ui.form.Layout = class Layout {
} }


make_section(df) { 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 // append to layout fields
if (df) { if (df) {


+ 2
- 2
frappe/public/js/frappe/form/section.js ファイルの表示

@@ -1,6 +1,6 @@
export default class Section { 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.parent = parent;
this.df = df || {}; this.df = df || {};
this.fields_list = []; this.fields_list = [];


読み込み中…
キャンセル
保存