summaryrefslogtreecommitdiff
path: root/addons/pad/static/src
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@openerp.com>2012-12-21 14:42:27 +0100
committerChristophe Matthieu <chm@openerp.com>2012-12-21 14:42:27 +0100
commit558fcc4471f3b5bf4ee9675a36ad834d611d9fca (patch)
treef635a32b142d5fb4e0d6af545202ed85e98bcfeb /addons/pad/static/src
parentf3a71a1dc3a82b09e62c366e025739941e94f3e8 (diff)
parent86a1802556cae70401f450c15a9bd51f5ccf9249 (diff)
[MERGE] 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.
bzr revid: chm@openerp.com-20121221134227-1nbb922oz37ibjw5
Diffstat (limited to 'addons/pad/static/src')
-rw-r--r--addons/pad/static/src/js/pad.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/addons/pad/static/src/js/pad.js b/addons/pad/static/src/js/pad.js
index 9e1b73e1f3b..b96047340ad 100644
--- a/addons/pad/static/src/js/pad.js
+++ b/addons/pad/static/src/js/pad.js
@@ -4,6 +4,13 @@ openerp.pad = function(instance) {
template: 'FieldPad',
configured: false,
content: "",
+ start: function() {
+ this._super();
+ var self = this;
+ this.on('change:effective_readonly',this,function(){
+ self.renderElement();
+ });
+ },
render_value: function() {
var self = this;
var _super = _.bind(this._super, this);
@@ -27,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 = "";
@@ -36,7 +46,8 @@ openerp.pad = function(instance) {
this.content = '<iframe width="100%" height="100%" frameborder="0" src="'+value+'?showChat=false&userName='+this.session.username+'"></iframe>';
}else{
this.content = '<div class="oe_pad_loading">... Loading pad ...</div>';
- $.get(value+'/export/html').success(function(data){
+ 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('<div class="oe_pad_readonly"><div>');
@@ -51,9 +62,6 @@ openerp.pad = function(instance) {
this.$('.oe_pad_switch').click(function(){
self.$el.toggleClass('oe_pad_fullscreen');
});
- this.on('change:effective_readonly',this,function(){
- self.renderElement();
- });
},
});