Christophe Matthieu (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-fix-etherpad-chm into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-fix-etherpad-chm/+merge/137507

[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.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-fix-etherpad-chm/+merge/137507
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-fix-etherpad-chm.
=== modified file 'pad/static/src/js/pad.js'
--- pad/static/src/js/pad.js	2012-11-20 15:51:55 +0000
+++ pad/static/src/js/pad.js	2012-12-03 08:54:30 +0000
@@ -4,6 +4,16 @@
         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 @@
                 }else{
                     this.content = '<div class="oe_pad_loading">... Loading pad ...</div>';
                     $.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('<div class="oe_pad_readonly"><div>');
                         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();
-            });
         },
     });
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to