diff --git a/core/doctype/customize_form/customize_form.js b/core/doctype/customize_form/customize_form.js index ac60263552..602ee04afd 100644 --- a/core/doctype/customize_form/customize_form.js +++ b/core/doctype/customize_form/customize_form.js @@ -20,6 +20,12 @@ // OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +$(cur_frm.wrapper).on("grid-row-render", function(e, grid_row) { + if(grid_row.doc && grid_row.doc.fieldtype=="Section Break") { + $(grid_row.row).css({"font-weight": "bold"}); + } +}) + cur_frm.cscript.doc_type = function(doc, dt, dn) { cur_frm.call({ method: "get", @@ -81,6 +87,11 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { } cur_frm.cscript.hide_allow_attach(doc, dt, dn); + + if(wn.route_options) { + wn.model.set_value("Customize Form", null, "doc_type", wn.route_options.doctype) + wn.route_options = null; + } } cur_frm.cscript.hide_allow_attach = function(doc, dt, dn) { diff --git a/public/build.json b/public/build.json index 80b79f70c8..bb60803a6e 100644 --- a/public/build.json +++ b/public/build.json @@ -108,7 +108,6 @@ "lib/public/js/wn/ui/toolbar/bookmarks.js", "lib/public/js/wn/ui/toolbar/toolbar.js", - "lib/public/js/legacy/widgets/form/form_dialog.js", "lib/public/js/legacy/widgets/form/form.js", "lib/public/js/legacy/widgets/form/print_format.js", "lib/public/js/legacy/widgets/form/clientscriptAPI.js", diff --git a/public/js/legacy/widgets/form/fields.js b/public/js/legacy/widgets/form/fields.js deleted file mode 100644 index 709d504b3a..0000000000 --- a/public/js/legacy/widgets/form/fields.js +++ /dev/null @@ -1,1115 +0,0 @@ -// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com) -// -// MIT License (MIT) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -// fields.js -// -// Fields are divided into 2 types -// 1. Standard fields are loaded with the libarary -// 2. Special fields are loaded with form.compressed.js -// -// -// + wrapper -// + input_area -// + display_area -// ====================================================================================== -var no_value_fields = ['Section Break', 'Column Break', 'HTML', 'Table', 'FlexTable', 'Button', 'Image']; -var codeid=0; var code_editors={}; - -function Field() { - this.with_label = 1; -} - -Field.prototype.make_body = function() { - // parent element - this.$wrapper = $('
' + this.df.description + '
') - .appendTo(this.wrapper); - } - } -} - -_f.TableField.prototype.refresh = function() { - if(!this.grid)return; - - // hide / show grid - var st = this.get_status(); - - if(!this.df['default']) - this.df['default']=''; - - this.grid.can_add_rows = false; - this.grid.can_edit = false; - - if(st=='Write') { - this.grid.can_edit = true; - if(this.df['default'].toLowerCase()!='no toolbar') - this.grid.can_add_rows = true; - - if(this.df['default'].toLowerCase()=='no add rows') { - this.grid.can_add_rows = false; - } - } - - $(this.wrapper).toggle(st=='Write' || st=="Read"); - this.grid.refresh(); -} - -_f.TableField.prototype.set = function(v) { }; // nothing -_f.TableField.prototype.set_input = function(v) { }; // nothing - - -_f.CodeField = function() { }; -_f.CodeField.prototype = new Field(); -_f.CodeField.prototype.make_input = function() { - var me = this; - - this.label_span.innerHTML = this.df.label; - - $(this.input_area).css({"min-height":"360px"}); - - if(this.df.fieldtype=='Text Editor') { - this.input = new wn.editors.BootstrapWYSIWYG({ - parent: this.input_area, - change: function(value) { - me.set_value_and_run_trigger(value); - }, - field: this - }); - } else { - this.input = new wn.editors.ACE({ - parent: this.input_area, - change: function(value) { - me.set_value_and_run_trigger(value); - }, - field: this - }); - } - this.get_value = function() { - return this.input.get_value(); - } -} - -_f.CodeField.prototype.set_value_and_run_trigger = function(value) { - if(locals[cur_frm.doctype][cur_frm.docname][this.df.fieldname] != value) { - this.set(value); - this.changing_value = true; - this.run_trigger(); - this.changing_value = false; - } -} - -_f.CodeField.prototype.set_disp = function(val) { - $y(this.disp_area, {width:'90%'}) - if(this.df.fieldtype=='Text Editor') { - this.disp_area.innerHTML = val; - } else { - this.disp_area.innerHTML = ''; - } -} diff --git a/public/js/legacy/widgets/form/form_header.js b/public/js/legacy/widgets/form/form_header.js deleted file mode 100644 index 9fed221fef..0000000000 --- a/public/js/legacy/widgets/form/form_header.js +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com) -// -// MIT License (MIT) -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -// features -// -------- -// toolbar - standard and custom -// label - saved, submitted etc -// save / submit button toggle based on "saved" or not -// highlight and fade name based on refresh - -_f.FrmHeader = Class.extend({ - init: function(parent, frm) { - this.appframe = frm.appframe; - this.$w = this.appframe.$w; - this.frm = frm; - - this.appframe.add_home_breadcrumb(); - this.appframe.add_module_icon(frm.meta.module) - this.appframe.set_views_for(frm.meta.name, "form"); - - if(!frm.meta.issingle) { - if(frm.cscript.add_list_breadcrumb) { - frm.cscript.add_list_breadcrumb(this.appframe); - } else { - this.appframe.add_list_breadcrumb(frm.meta.name); - } - } - this.appframe.add_breadcrumb("icon-file"); - }, - refresh: function() { - var me = this; - var title = this.frm.docname; - if(title.length > 30) { - title = title.substr(0,30) + "..."; - } - this.appframe.set_title(title, wn._(this.frm.docname)); - this.appframe.set_sub_title(this.frm.doc.__islocal ? "Not Saved" - : "Last Updated on " + dateutil.str_to_user(this.frm.doc.modified) + " by " + this.frm.doc.modified_by) - //this.refresh_timestamps(); - }, - refresh_timestamps: function() { - this.$w.find(".avatar").remove(); - - var doc = this.frm.doc; - if(doc.__islocal || !doc.owner || !doc.modified_by) - return; - - $(repl('\ -