[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
This commit is contained in:
Christophe Matthieu 2012-12-21 14:42:27 +01:00
commit 558fcc4471
4 changed files with 18 additions and 6 deletions

View File

@ -2,13 +2,15 @@
.oe_kanban_column .note_text_line_through { .oe_kanban_column .note_text_line_through {
text-decoration: line-through; text-decoration: line-through;
} }
.openerp .oe_form .oe_form_field.oe_memo { .openerp .oe_form .oe_form_field.oe_memo {
margin: 0 -16px 0 -16px; margin: 0 -16px 0 -16px;
padding: 0px; padding: 0px;
width: 100%; width: 100%;
min-height: 200px; min-height: 200px;
} }
.openerp .oe_form .oe_pad.oe_memo {
width: auto;
}
.openerp .oe_form .oe_form_field.oe_memo .cleditorMain { .openerp .oe_form .oe_form_field.oe_memo .cleditorMain {
border: none; border: none;
padding: 0px; padding: 0px;

View File

@ -17,6 +17,8 @@
.openerp .openerp
.oe_form .oe_form
.oe_pad.oe_memo
width: auto
.oe_form_field.oe_memo .oe_form_field.oe_memo
margin: 0 -16px 0 -16px margin: 0 -16px 0 -16px
padding: 0px padding: 0px

View File

@ -7,7 +7,7 @@
<field name="inherit_id" ref="note.view_note_note_form"/> <field name="inherit_id" ref="note.view_note_note_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="memo" position="replace"> <field name="memo" position="replace">
<field name="note_pad_url" widget="pad"/> <field name="note_pad_url" widget="pad" class="oe_memo"/>
</field> </field>
</field> </field>
</record> </record>

View File

@ -4,6 +4,13 @@ openerp.pad = function(instance) {
template: 'FieldPad', template: 'FieldPad',
configured: false, configured: false,
content: "", content: "",
start: function() {
this._super();
var self = this;
this.on('change:effective_readonly',this,function(){
self.renderElement();
});
},
render_value: function() { render_value: function() {
var self = this; var self = this;
var _super = _.bind(this._super, this); var _super = _.bind(this._super, this);
@ -27,6 +34,9 @@ openerp.pad = function(instance) {
renderElement: function(){ renderElement: function(){
var self = this; var self = this;
var value = this.get('value'); var value = this.get('value');
if (this.pad_loading_request) {
this.pad_loading_request.abort();
}
if(!_.str.startsWith(value,'http')){ if(!_.str.startsWith(value,'http')){
this.configured = false; this.configured = false;
this.content = ""; 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>'; this.content = '<iframe width="100%" height="100%" frameborder="0" src="'+value+'?showChat=false&userName='+this.session.username+'"></iframe>';
}else{ }else{
this.content = '<div class="oe_pad_loading">... Loading pad ...</div>'; 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); groups = /\<\s*body\s*\>(.*?)\<\s*\/body\s*\>/.exec(data);
data = (groups || []).length >= 2 ? groups[1] : ''; data = (groups || []).length >= 2 ? groups[1] : '';
self.$('.oe_pad_content').html('<div class="oe_pad_readonly"><div>'); 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(){ this.$('.oe_pad_switch').click(function(){
self.$el.toggleClass('oe_pad_fullscreen'); self.$el.toggleClass('oe_pad_fullscreen');
}); });
this.on('change:effective_readonly',this,function(){
self.renderElement();
});
}, },
}); });