[FIX] visual problem in some cases in field texts, solved by switching field texts to simple html output instead of textarea when in read-only mode
lp bug: https://launchpad.net/bugs/1149640 fixed bzr revid: nicolas.vanhoren@openerp.com-20130306151306-1qwv04bvw50z81z9
This commit is contained in:
parent
d1c7b2bf3c
commit
13ec67e478
|
@ -2308,6 +2308,13 @@
|
|||
.openerp .oe_form .oe_form_field_text {
|
||||
width: 100%;
|
||||
}
|
||||
.openerp .oe_form .oe_form_field_text .oe_form_text_content {
|
||||
text-overflow: ellipsis;
|
||||
display: inline-block;
|
||||
white-space: pre-wrap;
|
||||
overflow-x: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
.openerp .oe_form .oe_form_field_char input,
|
||||
.openerp .oe_form .oe_form_field_url input,
|
||||
.openerp .oe_form .oe_form_field_email input,
|
||||
|
|
|
@ -1832,6 +1832,12 @@ $sheet-padding: 16px
|
|||
.oe_form
|
||||
.oe_form_field_text
|
||||
width: 100%
|
||||
.oe_form_text_content
|
||||
text-overflow: ellipsis
|
||||
display: inline-block
|
||||
white-space: pre-wrap
|
||||
overflow-x: hidden
|
||||
width: 100%
|
||||
.oe_form_field_char input,
|
||||
.oe_form_field_url input,
|
||||
.oe_form_field_email input,
|
||||
|
|
|
@ -2559,42 +2559,43 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we
|
|||
},
|
||||
'change textarea': 'store_dom_value',
|
||||
},
|
||||
init: function (field_manager, node) {
|
||||
this._super(field_manager, node);
|
||||
},
|
||||
initialize_content: function() {
|
||||
var self = this;
|
||||
this.$textarea = this.$el.find('textarea');
|
||||
this.auto_sized = false;
|
||||
this.default_height = this.$textarea.css('height');
|
||||
if (this.get("effective_readonly")) {
|
||||
this.$textarea.attr('disabled', 'disabled');
|
||||
if (! this.get("effective_readonly")) {
|
||||
this.$textarea = this.$el.find('textarea');
|
||||
this.auto_sized = false;
|
||||
this.default_height = this.$textarea.css('height');
|
||||
if (this.get("effective_readonly")) {
|
||||
this.$textarea.attr('disabled', 'disabled');
|
||||
}
|
||||
this.setupFocus(this.$textarea);
|
||||
} else {
|
||||
this.$textarea = undefined;
|
||||
}
|
||||
this.setupFocus(this.$textarea);
|
||||
},
|
||||
commit_value: function () {
|
||||
this.store_dom_value();
|
||||
return this._super();
|
||||
},
|
||||
store_dom_value: function () {
|
||||
if (!this.get('effective_readonly') && this.$('textarea').length) {
|
||||
this.internal_set_value(
|
||||
instance.web.parse_value(
|
||||
this.$textarea.val(),
|
||||
this));
|
||||
}
|
||||
this.internal_set_value(instance.web.parse_value(this.$textarea.val(), this));
|
||||
},
|
||||
render_value: function() {
|
||||
var show_value = instance.web.format_value(this.get('value'), this, '');
|
||||
if (show_value === '') {
|
||||
this.$textarea.css('height', parseInt(this.default_height)+"px");
|
||||
}
|
||||
this.$textarea.val(show_value);
|
||||
if (! this.auto_sized) {
|
||||
this.auto_sized = true;
|
||||
this.$textarea.autosize();
|
||||
if (! this.get("effective_readonly")) {
|
||||
var show_value = instance.web.format_value(this.get('value'), this, '');
|
||||
if (show_value === '') {
|
||||
this.$textarea.css('height', parseInt(this.default_height)+"px");
|
||||
}
|
||||
this.$textarea.val(show_value);
|
||||
if (! this.auto_sized) {
|
||||
this.auto_sized = true;
|
||||
this.$textarea.autosize();
|
||||
} else {
|
||||
this.$textarea.trigger("autosize");
|
||||
}
|
||||
} else {
|
||||
this.$textarea.trigger("autosize");
|
||||
var txt = this.get("value");
|
||||
this.$(".oe_form_text_content").text(txt);
|
||||
}
|
||||
},
|
||||
is_syntax_valid: function() {
|
||||
|
@ -2612,14 +2613,18 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we
|
|||
return this.get('value') === '' || this._super();
|
||||
},
|
||||
focus: function($el) {
|
||||
this.$textarea[0].focus();
|
||||
if (!this.get("effective_readonly") && this.$textarea) {
|
||||
this.$textarea[0].focus();
|
||||
}
|
||||
},
|
||||
set_dimensions: function (height, width) {
|
||||
this._super(height, width);
|
||||
this.$textarea.css({
|
||||
width: width,
|
||||
minHeight: height
|
||||
});
|
||||
if (!this.get("effective_readonly") && this.$textarea) {
|
||||
this.$textarea.css({
|
||||
width: width,
|
||||
minHeight: height
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -1032,17 +1032,22 @@
|
|||
</t>
|
||||
<t t-name="FieldText">
|
||||
<div class="oe_form_field oe_form_field_text" t-att-style="widget.node.attrs.style">
|
||||
<textarea rows="6"
|
||||
t-att-name="widget.name"
|
||||
class="field_text"
|
||||
t-att-tabindex="widget.node.attrs.tabindex"
|
||||
t-att-autofocus="widget.node.attrs.autofocus"
|
||||
t-att-placeholder="! widget.get('effective_readonly') ? widget.node.attrs.placeholder : ''"
|
||||
t-att-maxlength="widget.field.size"
|
||||
></textarea><img class="oe_field_translate oe_input_icon"
|
||||
t-if="widget.field.translate and !widget.get('effective_readonly')"
|
||||
t-att-src='_s + "/web/static/src/img/icons/terp-translate.png"' width="16" height="16" border="0"
|
||||
/>
|
||||
<t t-if="!widget.get('effective_readonly')">
|
||||
<textarea rows="6"
|
||||
t-att-name="widget.name"
|
||||
class="field_text"
|
||||
t-att-tabindex="widget.node.attrs.tabindex"
|
||||
t-att-autofocus="widget.node.attrs.autofocus"
|
||||
t-att-placeholder="! widget.get('effective_readonly') ? widget.node.attrs.placeholder : ''"
|
||||
t-att-maxlength="widget.field.size"
|
||||
></textarea><img class="oe_field_translate oe_input_icon"
|
||||
t-if="widget.field.translate and !widget.get('effective_readonly')"
|
||||
t-att-src='_s + "/web/static/src/img/icons/terp-translate.png"' width="16" height="16" border="0"
|
||||
/>
|
||||
</t>
|
||||
<t t-if="widget.get('effective_readonly')">
|
||||
<span class="oe_form_text_content"></span>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="FieldTextHtml">
|
||||
|
|
Loading…
Reference in New Issue