From a8a9265340e3948fa3885128e4ea4350cb158826 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 2 Mar 2015 13:43:52 +0100 Subject: [PATCH] [FIX] website: backend html widget: only use an iframe if field is not readonly --- .../website/static/src/js/website.backend.js | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/addons/website/static/src/js/website.backend.js b/addons/website/static/src/js/website.backend.js index 158ad12c029..2345ca0fd3a 100644 --- a/addons/website/static/src/js/website.backend.js +++ b/addons/website/static/src/js/website.backend.js @@ -46,15 +46,9 @@ instance.web.form.FieldTextHtml = widget.extend({ // init resize this.resize = function resize() { + if (self.get('effective_readonly')) { return; } if ($("body").hasClass("o_form_FieldTextHtml_fullscreen")) { self.$iframe.css('height', $("body").hasClass('o_form_FieldTextHtml_fullscreen') ? (document.body.clientHeight - self.$iframe.offset().top) + 'px' : ''); - } else if (self.get('effective_readonly')) { - var height = 110; - try { - height += self.$body.height(); - height += parseInt(self.$content.parent().css("margin-top")); - } catch (e) {} - self.$iframe.css("height", height+"px"); } else { self.$iframe.css("height", (self.$body.find("#oe_snippets").length ? 500 : 300) + "px"); } @@ -93,15 +87,17 @@ instance.web.form.FieldTextHtml = widget.extend({ return src; }, initialize_content: function() { - this.$iframe = this.$el.find('iframe'); - this.document = null; - this.$body = $(); - this.$content = $(); - this.dirty = false; - this.editor = false; - window.openerp[this.callback+"_set_value"] = function () {}; + if (!this.get("effective_readonly")) { + this.$iframe = this.$el.find('iframe'); + this.document = null; + this.$body = $(); + this.$content = $(); + this.dirty = false; + this.editor = false; + window.openerp[this.callback+"_set_value"] = function () {}; - this.$iframe.attr("src", this.get_url()); + this.$iframe.attr("src", this.get_url()); + } }, on_content_loaded: function () { var self = this; @@ -134,12 +130,16 @@ instance.web.form.FieldTextHtml = widget.extend({ }, 500); }, render_value: function() { - if (!this.$content) { - return; - } - if(window.openerp[this.callback+"_set_value"]) { - window.openerp[this.callback+"_set_value"](this.get('value') || '', this.view.get_fields_values()); - this.resize(); + if (!this.get("effective_readonly")) { + if (!this.$content) { + return; + } + if(window.openerp[this.callback+"_set_value"]) { + window.openerp[this.callback+"_set_value"](this.get('value') || '', this.view.get_fields_values()); + this.resize(); + } + } else { + this.$el.html(this.get('value')); } }, is_false: function() { @@ -160,4 +160,4 @@ instance.web.form.FieldTextHtml = widget.extend({ } }); -}; \ No newline at end of file +};