From ffe7fd9bcc800498681c20215141139478635b32 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 3 Dec 2012 09:51:16 +0100 Subject: [PATCH 1/4] [FIX] etherpad: When a user access to the edit mode from a kanban view or list view, etherpad is dipslay on readonly mode but with the oe_editing class. Why: The deferer for read only arrive after the display of edit mode. Fix: check in the deferer if the etherpad is already in readonly mode. bzr revid: chm@openerp.com-20121203085116-jn83em3pd5le28rp --- addons/pad/static/src/js/pad.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/addons/pad/static/src/js/pad.js b/addons/pad/static/src/js/pad.js index 9e1b73e1f3b..5b33fd3eaa1 100644 --- a/addons/pad/static/src/js/pad.js +++ b/addons/pad/static/src/js/pad.js @@ -4,6 +4,16 @@ openerp.pad = function(instance) { template: 'FieldPad', configured: false, content: "", + start: function() { + this._super.apply(this, arguments); + var self = this; + this.on('click', '.oe_pad_switch', function(){ + self.$el.toggleClass('oe_pad_fullscreen'); + }); + this.on('change:effective_readonly',this,function(){ + self.renderElement(); + }); + }, render_value: function() { var self = this; var _super = _.bind(this._super, this); @@ -37,23 +47,23 @@ openerp.pad = function(instance) { }else{ this.content = '
... Loading pad ...
'; $.get(value+'/export/html').success(function(data){ + if(!self.get('effective_readonly')){ + return false; + } groups = /\<\s*body\s*\>(.*?)\<\s*\/body\s*\>/.exec(data); data = (groups || []).length >= 2 ? groups[1] : ''; self.$('.oe_pad_content').html('
'); self.$('.oe_pad_readonly').html(data); }).error(function(){ + if(!self.get('effective_readonly')){ + return false; + } self.$('.oe_pad_content').text('Unable to load pad'); }); } } this._super(); this.$('.oe_pad_content').html(this.content); - this.$('.oe_pad_switch').click(function(){ - self.$el.toggleClass('oe_pad_fullscreen'); - }); - this.on('change:effective_readonly',this,function(){ - self.renderElement(); - }); }, }); From 23b6b96fbc4dccf5d6bba6eda2e04ddf8a9d3224 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 13 Dec 2012 15:57:14 +0100 Subject: [PATCH 2/4] [IMP] pad: add abord for $.get request bzr revid: chm@openerp.com-20121213145714-b9d4f2u8iqdg8r1m --- addons/pad/static/src/js/pad.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/addons/pad/static/src/js/pad.js b/addons/pad/static/src/js/pad.js index 5b33fd3eaa1..5cd2ac622cb 100644 --- a/addons/pad/static/src/js/pad.js +++ b/addons/pad/static/src/js/pad.js @@ -7,9 +7,6 @@ openerp.pad = function(instance) { start: function() { this._super.apply(this, arguments); var self = this; - this.on('click', '.oe_pad_switch', function(){ - self.$el.toggleClass('oe_pad_fullscreen'); - }); this.on('change:effective_readonly',this,function(){ self.renderElement(); }); @@ -37,6 +34,9 @@ openerp.pad = function(instance) { renderElement: function(){ var self = this; var value = this.get('value'); + if (this.pad_loading_request) { + this.pad_loading_request.abort(); + } if(!_.str.startsWith(value,'http')){ this.configured = false; this.content = ""; @@ -46,24 +46,22 @@ openerp.pad = function(instance) { this.content = ''; }else{ this.content = '
... Loading pad ...
'; - $.get(value+'/export/html').success(function(data){ - if(!self.get('effective_readonly')){ - return false; - } + this.pad_loading_request = $.get(value+'/export/html') + .done(function(data){ groups = /\<\s*body\s*\>(.*?)\<\s*\/body\s*\>/.exec(data); data = (groups || []).length >= 2 ? groups[1] : ''; self.$('.oe_pad_content').html('
'); self.$('.oe_pad_readonly').html(data); }).error(function(){ - if(!self.get('effective_readonly')){ - return false; - } self.$('.oe_pad_content').text('Unable to load pad'); }); } } this._super(); this.$('.oe_pad_content').html(this.content); + this.$('.oe_pad_switch').click(function(){ + self.$el.toggleClass('oe_pad_fullscreen'); + }); }, }); From d010441fe362537571d27f7bf0b21cdf498f96b0 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 13 Dec 2012 15:58:55 +0100 Subject: [PATCH 3/4] [IMP] pad: remove attributes for super bzr revid: chm@openerp.com-20121213145855-0aq9wqtovyrxzxkw --- addons/pad/static/src/js/pad.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/pad/static/src/js/pad.js b/addons/pad/static/src/js/pad.js index 5cd2ac622cb..b96047340ad 100644 --- a/addons/pad/static/src/js/pad.js +++ b/addons/pad/static/src/js/pad.js @@ -5,7 +5,7 @@ openerp.pad = function(instance) { configured: false, content: "", start: function() { - this._super.apply(this, arguments); + this._super(); var self = this; this.on('change:effective_readonly',this,function(){ self.renderElement(); From 86a1802556cae70401f450c15a9bd51f5ccf9249 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 13 Dec 2012 16:58:21 +0100 Subject: [PATCH 4/4] [IMP] note pad: with 100% bzr revid: chm@openerp.com-20121213155821-ufh8exnm2qid01b5 --- addons/note/static/src/css/note.css | 5 ++++- addons/note_pad/note_pad_view.xml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/note/static/src/css/note.css b/addons/note/static/src/css/note.css index 16d71e28aa5..ecf07a37b62 100644 --- a/addons/note/static/src/css/note.css +++ b/addons/note/static/src/css/note.css @@ -2,13 +2,16 @@ .oe_kanban_column .note_text_line_through { text-decoration: line-through; } - .openerp .oe_form .oe_form_field.oe_memo { margin: 0 -16px 0 -16px; padding: 0px; width: 100%; min-height: 200px; } +.openerp .oe_form .oe_pad.oe_memo { + margin: 0 -16px 0 -16px; + width: auto; +} .openerp .oe_form .oe_form_field.oe_memo .cleditorMain { border: none; padding: 0px; diff --git a/addons/note_pad/note_pad_view.xml b/addons/note_pad/note_pad_view.xml index 9e45a3952f1..0032905b6b5 100644 --- a/addons/note_pad/note_pad_view.xml +++ b/addons/note_pad/note_pad_view.xml @@ -7,7 +7,7 @@ - +