From 8c43cbf5c5f2dff0ef45fcfc7176ef8a1ca2f3c4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 27 Dec 2012 14:05:01 +0530 Subject: [PATCH] address now not in dialog, added slideshows in products and groups and removed transaction history from customer / supplier / sales partner --- public/css/legacy/fields.css | 3 +++ public/js/legacy/widgets/form/fields.js | 28 ++++++++++++------------- public/js/legacy/widgets/form/form.js | 3 +++ public/js/wn/ui/listing.js | 10 ++++----- webnotes/__init__.py | 4 ++++ 5 files changed, 28 insertions(+), 20 deletions(-) diff --git a/public/css/legacy/fields.css b/public/css/legacy/fields.css index 997165cdeb..65cc8b1364 100644 --- a/public/css/legacy/fields.css +++ b/public/css/legacy/fields.css @@ -16,6 +16,9 @@ } .datainputcell { padding: 2px 0px; } +.field-wrapper .help { + margin-top: -5px; +} .help ol { padding-left: 19px; diff --git a/public/js/legacy/widgets/form/fields.js b/public/js/legacy/widgets/form/fields.js index 5834bd9e28..34beed01b9 100644 --- a/public/js/legacy/widgets/form/fields.js +++ b/public/js/legacy/widgets/form/fields.js @@ -47,26 +47,30 @@ Field.prototype.make_body = function() { else this.wrapper = document.createElement((this.with_label || this.df.fieldtype=="HTML" ? 'div' : 'span')); + $(this.wrapper).addClass("field-wrapper"); + this.label_area = $a(this.wrapper, 'div', '', {margin:'0px 0px 2px 0px', minHeight:'1em'}); + var label_wrapper = this.label_area; if(ischk && !this.in_grid) { - this.input_area = $a(this.label_area, 'span', '', {marginRight:'4px'}); - this.disp_area = $a(this.label_area, 'span', '', {marginRight:'4px'}); + var label_wrapper = $("
").appendTo(this.label_area).get(0); + this.input_area = $a(label_wrapper, 'span', '', {marginRight:'4px'}); + this.disp_area = $a(label_wrapper, 'span', '', {marginRight:'4px'}); } // label - if(this.with_label) { - this.label_span = $a(this.label_area, 'span', 'small') + if(this.with_label) { + this.label_span = $a(label_wrapper, 'span', 'small') // error icon this.label_icon = $('').toggle(false) - .appendTo(this.label_area).css('margin-left','7px') + .appendTo(label_wrapper).css('margin-left','7px') .attr("title", "This field is mandatory."); } else { - this.label_span = $a(this.label_area, 'span', '', {marginRight:'4px'}) - $dh(this.label_area); + this.label_span = $a(label_wrapper, 'span', '', {marginRight:'4px'}) + $dh(label_wrapper); } // make the input areas @@ -873,15 +877,12 @@ CheckField.prototype.validate = function(v) { return v; }; CheckField.prototype.onmake = function() { - this.checkimg = $a(this.disp_area, 'div'); - var img = $a(this.checkimg, 'img'); - img.src = 'lib/images/ui/tick.gif'; - $dh(this.checkimg); + this.checkimg = $("").appendTo(this.disp_area); } CheckField.prototype.make_input = function() { var me = this; this.input = $a_input(this.input_area,'checkbox'); - $y(this.input, {width:"16px", border:'0px', margin:'2px'}); // no specs for checkbox + $y(this.input, {width:"16px", border:'0px', marginTop:'-2px'}); // no specs for checkbox $(this.input).click(function() { me.set(this.checked?1:0); @@ -900,8 +901,7 @@ CheckField.prototype.make_input = function() { var me = this; } CheckField.prototype.set_disp = function(val) { - if (val){ $ds(this.checkimg); } - else { $dh(this.checkimg); } + this.checkimg.toggle(val); } // ====================================================================================== diff --git a/public/js/legacy/widgets/form/form.js b/public/js/legacy/widgets/form/form.js index 80b09efae1..9cc7a61b31 100644 --- a/public/js/legacy/widgets/form/form.js +++ b/public/js/legacy/widgets/form/form.js @@ -458,6 +458,9 @@ _f.Frm.prototype.refresh_header = function() { if(!this.meta.in_dialog || this.in_form) { set_title(this.meta.issingle ? this.doctype : this.docname); } + + if(wn.ui.toolbar.recent) + wn.ui.toolbar.recent.add(this.doctype, this.docname, 1); // show / hide buttons if(this.frm_head)this.frm_head.refresh(); diff --git a/public/js/wn/ui/listing.js b/public/js/wn/ui/listing.js index 8b7af302df..554ce498ce 100644 --- a/public/js/wn/ui/listing.js +++ b/public/js/wn/ui/listing.js @@ -96,7 +96,7 @@ wn.ui.Listing = Class.extend({
\ \
\ -
\ +
\
\
\ ') .appendTo(this.$w.find('.list-toolbar')) - if(icon) { - $('').addClass(icon).appendTo($button); - } - $button.html(label).click(click); + .html((icon ? (" ") : "") + label) + .click(click); return $button } }, @@ -164,7 +162,7 @@ wn.ui.Listing = Class.extend({ // hide-refresh if(!(this.hide_refresh || this.no_refresh)) { - this.add_button('Refresh', function() { + this.add_button('', function() { me.run(); }, 'icon-refresh'); diff --git a/webnotes/__init__.py b/webnotes/__init__.py index 458107c64d..52020e06df 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -304,6 +304,10 @@ def delete_doc(doctype=None, name=None, doclist = None, force=0): def clear_perms(doctype): conn.sql("""delete from tabDocPerm where parent=%s""", doctype) +def reset_perms(doctype): + clear_perms(doctype) + reload_doc(conn.get_value("DocType", doctype, "module"), "DocType", doctype) + def reload_doc(module, dt=None, dn=None): import webnotes.modules return webnotes.modules.reload_doc(module, dt, dn)