From 055ed1069f5a82d1eb4f51bac04894bc75f31612 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 10 Jul 2012 17:22:30 +0530 Subject: [PATCH 1/5] cost center cleanup + grid css --- css/legacy/forms.css | 14 +----- css/legacy/grid.css | 72 +++++++++++++-------------- js/legacy/widgets/form/form_fields.js | 9 ++-- js/legacy/widgets/form/form_grid.js | 32 ++++++------ js/legacy/widgets/form/grid.js | 4 +- 5 files changed, 59 insertions(+), 72 deletions(-) diff --git a/css/legacy/forms.css b/css/legacy/forms.css index 6e005ea472..972e971e45 100644 --- a/css/legacy/forms.css +++ b/css/legacy/forms.css @@ -21,7 +21,7 @@ div.form-section-head { div.form-layout-row:first-child .form-section-head { border-top: 0px solid #ccc !important; margin-top: 0px; - padding-top: 15px; + padding-top: 0px; } div.form-section-head h3 { @@ -48,18 +48,6 @@ div.page_break { border-top: 1px dashed #888; } -div.grid_tbarlinks { - border-bottom: 0px; - background-color: #CCC; - padding: 4px 4px 2px 4px; - width: 190px; - float: right; - - -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px; - -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -} - - div.dialog_frm { position: relative; margin: 10px; diff --git a/css/legacy/grid.css b/css/legacy/grid.css index 98eeffd6c7..dab62822b3 100644 --- a/css/legacy/grid.css +++ b/css/legacy/grid.css @@ -1,46 +1,36 @@ - -/* Grid */ - - -/* --- Simple --- */ -.grid_wrapper_simple { - width: 100%; - margin-bottom: 8px; - border: 1px solid #AA9; -} - -.grid_head_wrapper_simple { - padding: 0px; - border-bottom: 2px solid #AAA; -} - -.grid_head_wrapper_simple td { - border-right: 1px solid #AA9; -} - -.grid_head_wrapper_simple td div { - padding: 2px; -} - -.grid_tab_wrapper_simple { -} - -.grid_cell_simple { - padding: 2px; - background-color: #fff; - border-right: 1px solid #AA9; -} - - -/* --- Normal --- */ .grid_wrapper { position: relative; overflow: auto; border: 1px solid #AAA; width: 100%; margin-bottom: 8px; - background-color: #fff; + background-color: #f8f8f8; +} + +div.grid_tbarlinks { + border-bottom: 0px; + padding: 4px 4px 2px 4px; + width: 190px; + float: right; + margin-right: 12px; + + -webkit-border-top-left-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-topleft: 5px; + -moz-border-radius-topright: 5px; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + + background: #dddddd; /* Old browsers */ + background: -moz-linear-gradient(top, #dddddd 0%, #bbbbbb 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dddddd), color-stop(100%,#bbbbbb)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* IE10+ */ + background: linear-gradient(to bottom, #dddddd 0%,#bbbbbb 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dddddd', endColorstr='#bbbbbb',GradientType=0 ); /* IE6-9 */ + } .grid_tab_wrapper { @@ -71,11 +61,19 @@ } .grid_head_table td { - background-color: #EEE; border-right: 1px solid #AAA; border-bottom: 1px solid #AAA; height: 40px; padding: 0px; + + background: #eeeeee; /* Old browsers */ + background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */ + background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */ } .grid_head_table td div { diff --git a/js/legacy/widgets/form/form_fields.js b/js/legacy/widgets/form/form_fields.js index a26dc707c5..aebaeb574b 100644 --- a/js/legacy/widgets/form/form_fields.js +++ b/js/legacy/widgets/form/form_fields.js @@ -232,13 +232,14 @@ _f.TableField.prototype = new Field(); _f.TableField.prototype.with_label = 0; _f.TableField.prototype.make_body = function() { if(this.perm[this.df.permlevel] && this.perm[this.df.permlevel][READ]) { - // add comment area - if(this.df.description) { - this.desc_area = $a(this.parent, 'div', 'help small', '', this.df.description) - } this.grid = new _f.FormGrid(this); if(this.frm)this.frm.grids[this.frm.grids.length] = this; this.grid.make_buttons(); + + // description + if(this.df.description) { + this.desc_area = $a(this.parent, 'div', 'help small', '', this.df.description) + } } } diff --git a/js/legacy/widgets/form/form_grid.js b/js/legacy/widgets/form/form_grid.js index 4b06e3ab65..b50b9e35b1 100644 --- a/js/legacy/widgets/form/form_grid.js +++ b/js/legacy/widgets/form/form_grid.js @@ -42,6 +42,22 @@ _f.FormGrid.prototype.setup = function() { this.make_columns(); } +_f.FormGrid.prototype.make_buttons = function() { + var me = this; + this.tbar_btns = {}; + this.tbar_btns['Del'] = this.make_tbar_link($td(this.tbar_tab,0,0),'Del', + function() { me.delete_row(); }, 'icon-remove-sign'); + this.tbar_btns['Ins'] = this.make_tbar_link($td(this.tbar_tab,0,1),'Ins', + function() { me.insert_row(); }, 'icon-plus'); + this.tbar_btns['Up'] = this.make_tbar_link($td(this.tbar_tab,0,2),'Up', + function() { me.move_row(true); }, 'icon-arrow-up'); + this.tbar_btns['Dn'] = this.make_tbar_link($td(this.tbar_tab,0,3),'Dn', + function() { me.move_row(false); }, 'icon-arrow-down'); + + for(var i in this.btns) + this.btns[i].isactive = true; +} + _f.FormGrid.prototype.make_tbar_link = function(parent, label, fn, icon) { var div = $a(parent,'div','',{cursor:'pointer'}); @@ -66,22 +82,6 @@ _f.FormGrid.prototype.make_tbar_link = function(parent, label, fn, icon) { return div; } -_f.FormGrid.prototype.make_buttons = function() { - var me = this; - this.tbar_btns = {}; - this.tbar_btns['Del'] = this.make_tbar_link($td(this.tbar_tab,0,0),'Del', - function() { me.delete_row(); }, 'icon-remove-sign'); - this.tbar_btns['Ins'] = this.make_tbar_link($td(this.tbar_tab,0,1),'Ins', - function() { me.insert_row(); }, 'icon-plus'); - this.tbar_btns['Up'] = this.make_tbar_link($td(this.tbar_tab,0,2),'Up', - function() { me.move_row(true); }, 'icon-arrow-up'); - this.tbar_btns['Dn'] = this.make_tbar_link($td(this.tbar_tab,0,3),'Dn', - function() { me.move_row(false); }, 'icon-arrow-down'); - - for(var i in this.btns) - this.btns[i].isactive = true; -} - _f.FormGrid.prototype.make_columns = function() { var gl = wn.meta.docfield_list[this.field.df.options]; diff --git a/js/legacy/widgets/form/grid.js b/js/legacy/widgets/form/grid.js index db9763214a..e793fda351 100644 --- a/js/legacy/widgets/form/grid.js +++ b/js/legacy/widgets/form/grid.js @@ -54,13 +54,13 @@ _f.Grid.prototype.init = function(parent, row_height) { _f.Grid.prototype.make_ui = function(parent) { - var ht = make_table($a(parent, 'div'), 1, 2, '100%', ['60%','40%']); + var ht = make_table($a(parent, 'div'), 1, 2, '100%', ['55%','45%']); this.main_title = $td(ht,0,0); this.main_title.className = 'columnHeading'; $td(ht,0,1).style.textAlign = 'right'; this.tbar_div = $a($td(ht,0,1), 'div', 'grid_tbarlinks'); this.tbar_tab = make_table(this.tbar_div,1,4,'100%',['25%','25%','25%','25%']); - this.wrapper = $a(parent, 'div', 'grid_wrapper'); + this.wrapper = $a(parent, 'div', 'grid_wrapper round'); this.head_wrapper = $a(this.wrapper, 'div', 'grid_head_wrapper'); From 8f1bccb1e500af72d70bee4f5ee5205a397978ea Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 10 Jul 2012 17:39:27 +0530 Subject: [PATCH 2/5] form intro --- js/legacy/widgets/form/form.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/js/legacy/widgets/form/form.js b/js/legacy/widgets/form/form.js index e7dbc9bf81..75e9997b82 100644 --- a/js/legacy/widgets/form/form.js +++ b/js/legacy/widgets/form/form.js @@ -26,7 +26,7 @@ + this.wrapper + this.content + this.saved_wrapper - + wn.PageLayout (this.page_layout_layout) + + wn.PageLayout (this.page_layout) + this.wrapper + this.wtab (table) + this.main @@ -210,8 +210,7 @@ _f.Frm.prototype.print_doc = function() { _p.show_dialog(); // multiple options } -// ====================================================================================== - +// email the form _f.Frm.prototype.email_doc = function() { // make selector if(!_e.dialog) _e.make(); @@ -245,8 +244,7 @@ _f.Frm.prototype.email_doc = function() { _e.dialog.show(); } -// ====================================================================================== - +// notify this form of renamed records _f.Frm.prototype.rename_notify = function(dt, old, name) { // from form if(this.meta.in_dialog && !this.in_form) @@ -276,8 +274,6 @@ _f.Frm.prototype.rename_notify = function(dt, old, name) { } // SETUP -// ====================================================================================== - _f.Frm.prototype.setup_meta = function(doctype) { this.meta = get_local('DocType',this.doctype); @@ -287,13 +283,11 @@ _f.Frm.prototype.setup_meta = function(doctype) { } -// -------------------------------------------------------------------------------------- _f.Frm.prototype.setup_sidebar = function() { this.sidebar = new wn.widgets.form.sidebar.Sidebar(this); } -// -------------------------------------------------------------------------------------- _f.Frm.prototype.setup_footer = function() { var me = this; @@ -318,7 +312,13 @@ _f.Frm.prototype.setup_footer = function() { } } -// -------------------------------------------------------------------------------------- +_f.Frm.prototype.set_intro = function(txt) { + if(!this.intro_area) { + this.intro_area = $('
') + .insertBefore(this.page_layout.body.firstChild); + } + this.intro_area.html(txt); +} _f.Frm.prototype.setup_fields_std = function() { var fl = wn.meta.docfield_list[this.doctype]; From acb2d88b4c4fc6d014bbc67e8afb185304fcfda2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 10 Jul 2012 18:16:25 +0530 Subject: [PATCH 3/5] cost center cleanup --- css/legacy/body.css | 2 +- css/legacy/forms.css | 7 +++++++ js/legacy/widgets/form/form.js | 33 ++++++++++++++------------------- js/wn/ui/appframe.js | 2 +- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/css/legacy/body.css b/css/legacy/body.css index 9926f4c99e..b9d4140d89 100644 --- a/css/legacy/body.css +++ b/css/legacy/body.css @@ -135,7 +135,7 @@ div.fix_ff_cursor { overflow: auto; } div.comment { color: #444; } .small { - font-size: 11px; + font-size: 12px; } .help { diff --git a/css/legacy/forms.css b/css/legacy/forms.css index 972e971e45..ede2a20f73 100644 --- a/css/legacy/forms.css +++ b/css/legacy/forms.css @@ -12,6 +12,13 @@ div.form-title { margin-right: 7px; } +div.form-intro-area { + background-color: #ffe; + padding: 9px 9px 0px 9px; + border: 1px dashed #fc7; + margin-bottom: 15px; +} + div.form-section-head { margin: 11px -15px 3px -15px; border-top: 1px solid #ccc; diff --git a/js/legacy/widgets/form/form.js b/js/legacy/widgets/form/form.js index 8bbe98f66e..7519c48f7e 100644 --- a/js/legacy/widgets/form/form.js +++ b/js/legacy/widgets/form/form.js @@ -317,7 +317,13 @@ _f.Frm.prototype.set_intro = function(txt) { this.intro_area = $('
') .insertBefore(this.page_layout.body.firstChild); } - this.intro_area.html(txt); + if(txt) { + this.intro_area.html(txt); + } else { + this.intro_area.remove(); + this.intro_area = null; + } + } _f.Frm.prototype.setup_fields_std = function() { @@ -624,8 +630,6 @@ _f.Frm.prototype.refresh_footer = function() { } } -// -------------------------------------------------------------------------------------- - _f.Frm.prototype.refresh_fields = function() { // refresh fields for(var i=0; i'; + args.icon = ''; } this.buttons[label] = $(repl('', args)) From 58a7d11ed68db76b14fe001ba845f8808a44e1af Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 10 Jul 2012 18:39:13 +0530 Subject: [PATCH 4/5] account cleanup started --- css/legacy/fields.css | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/css/legacy/fields.css b/css/legacy/fields.css index ed3d2b4797..d1090e89c4 100644 --- a/css/legacy/fields.css +++ b/css/legacy/fields.css @@ -24,6 +24,10 @@ .input_area input, select, textarea { font-size: 14px; padding: 2px; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; } .input_area input { @@ -41,9 +45,16 @@ width: 80%; padding: 2px 0px; font-size: 12px; + background-color: #eee; + padding: 2px; + border: 1px solid #ddd; + + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; } .disp_area_no_val { - height: 14px; + min-height: 14px; } .no_img { From a38012142544e0f85ba1130b647c97bfd8a6be4d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 11 Jul 2012 09:51:35 +0530 Subject: [PATCH 5/5] account cleanup, added toggle_fields in cur_frm --- css/legacy/forms.css | 4 +--- css/legacy/messages.css | 19 ++++--------------- js/legacy/webpage/search.js | 12 +++++++----- js/legacy/widgets/form/clientscriptAPI.js | 4 ++-- js/legacy/widgets/form/form.js | 9 +++++++-- js/legacy/widgets/form/form_grid.js | 2 +- js/legacy/widgets/form/grid.js | 2 +- 7 files changed, 23 insertions(+), 29 deletions(-) diff --git a/css/legacy/forms.css b/css/legacy/forms.css index ede2a20f73..af04d08a69 100644 --- a/css/legacy/forms.css +++ b/css/legacy/forms.css @@ -13,10 +13,8 @@ div.form-title { } div.form-intro-area { - background-color: #ffe; padding: 9px 9px 0px 9px; - border: 1px dashed #fc7; - margin-bottom: 15px; + margin: 0px 0px 15px 0px; } div.form-section-head { diff --git a/css/legacy/messages.css b/css/legacy/messages.css index 88190813af..de09f4a3ff 100644 --- a/css/legacy/messages.css +++ b/css/legacy/messages.css @@ -30,20 +30,9 @@ div.notice { } .help_box, .help-box { - background-color:#FFC; - font-size: 13px; - color: #864; - padding: 7px; + background-color: #ffe; + color: #874; + padding: 9px 9px 9px 9px; + border: 1px dashed #fc7; margin: 11px 0px; - border: 1px solid #EEB; } - -.help_box_big { - background-color:#FFC; - color: #864; - padding: 7px; - margin: 7px 0px; - border: 1px solid #EEB; - text-align: center; - font-size: 14px; -} \ No newline at end of file diff --git a/js/legacy/webpage/search.js b/js/legacy/webpage/search.js index 3a773b1416..c0e50165af 100644 --- a/js/legacy/webpage/search.js +++ b/js/legacy/webpage/search.js @@ -38,10 +38,10 @@ function makeselector() { var d = new Dialog(540,440, 'Search'); d.make_body([ + ['HTML', 'Help'], ['Data', 'Beginning With', 'Tip: You can use wildcard "%"'], ['Select', 'Search By'], ['Button', 'Search'], - ['HTML', 'Help'], ['HTML', 'Result'] ]); @@ -64,7 +64,8 @@ function makeselector() { d.set_query_description() if(!d.sel_type)d.sel_type = 'Value'; - d.set_title('Select a "'+ d.sel_type +'" for field "'+label+'"'); + d.set_title("Select"); + d.set_query_description('Select a "'+ d.sel_type +'" for field "'+label+'"'); } d.set_search = function(dt) { if(d.style!='Search') { @@ -83,9 +84,10 @@ function makeselector() { } }) - d.set_query_description = function() { - if(d.input && d.input.query_description) { - d.rows['Help'].innerHTML ='
' + d.input.query_description + '
'; + d.set_query_description = function(txt) { + if(!txt) txt = d.input && d.input.query_description || null; + if(txt) { + d.rows['Help'].innerHTML ='
' + txt + '
'; } else { d.rows['Help'].innerHTML ='' } diff --git a/js/legacy/widgets/form/clientscriptAPI.js b/js/legacy/widgets/form/clientscriptAPI.js index 63cc84ed6f..f7cc74b207 100644 --- a/js/legacy/widgets/form/clientscriptAPI.js +++ b/js/legacy/widgets/form/clientscriptAPI.js @@ -134,7 +134,7 @@ hide_field = function(n) { else { console.log("hide_field cannot find field " + n); } } if(cur_frm) { - if(n.substr) _hide_field(n,1); + if(typeof n == 'string') _hide_field(n,1); else { for(var i in n)_hide_field(n[i],1) } } } @@ -146,7 +146,7 @@ unhide_field = function(n) { else { console.log("unhide_field cannot find field " + n); } } if(cur_frm) { - if(n.substr) _hide_field(n,0); + if(typeof n == 'string') _hide_field(n,0); else { for(var i in n)_hide_field(n[i],0) } } } diff --git a/js/legacy/widgets/form/form.js b/js/legacy/widgets/form/form.js index 7519c48f7e..6125020379 100644 --- a/js/legacy/widgets/form/form.js +++ b/js/legacy/widgets/form/form.js @@ -314,7 +314,7 @@ _f.Frm.prototype.setup_footer = function() { _f.Frm.prototype.set_intro = function(txt) { if(!this.intro_area) { - this.intro_area = $('
') + this.intro_area = $('
') .insertBefore(this.page_layout.body.firstChild); } if(txt) { @@ -1138,4 +1138,9 @@ _f.Frm.prototype.get_doc = function() { _f.Frm.prototype.get_doclist = function() { return make_doclist(this.doctype, this.docname); -} \ No newline at end of file +} + +_f.Frm.prototype.toggle_fields = function(fields, show) { + if(show) { unhide_field(fields) } + else { hide_field(fields) } +} diff --git a/js/legacy/widgets/form/form_grid.js b/js/legacy/widgets/form/form_grid.js index b50b9e35b1..bac0439fca 100644 --- a/js/legacy/widgets/form/form_grid.js +++ b/js/legacy/widgets/form/form_grid.js @@ -234,7 +234,7 @@ _f.FormGrid.prototype.delete_row = function(dt, dn) { LocalDB.delete_record(this.doctype, r.docname); this.refresh(); - if(ri < (this.tab.rows.length-2)) + if(ri < (this.tab.rows.length-1)) this.cell_select(null, ri, ci); else _f.cur_grid_cell = null; } diff --git a/js/legacy/widgets/form/grid.js b/js/legacy/widgets/form/grid.js index e793fda351..d7608779cb 100644 --- a/js/legacy/widgets/form/grid.js +++ b/js/legacy/widgets/form/grid.js @@ -296,7 +296,7 @@ _f.Grid.prototype.cell_deselect = function() { } _f.Grid.prototype.cell_select = function(cell, ri, ci) { - if(_f.cur_grid_cell==cell && cell.hc) return; + if(cell && _f.cur_grid_cell==cell && cell.hc) return; if(ri!=null && ci!=null) cell = this.tab.rows[ri].cells[ci];