[FIX] handle multilines in <label> tags of form views

bzr revid: fme@openerp.com-20120208143943-p6i12v8cd0ua831d
This commit is contained in:
Fabien Meghazi 2012-02-08 15:39:43 +01:00
commit 7b3094ee8a
3 changed files with 12 additions and 1 deletions

View File

@ -1307,6 +1307,10 @@ label.error {
white-space: normal;
}
.openerp .oe_forms .oe_form_paragraph.oe_multilines {
white-space: pre;
}
.openerp .oe_form_field_one2many .oe-actions h3.oe_view_title,
.openerp .oe_form_field_one2many_list .oe-actions h3.oe_view_title{
display: inline;

View File

@ -1197,6 +1197,11 @@ openerp.web.form.WidgetLabel = openerp.web.form.Widget.extend({
this._super(view, node);
if (this.node.tag == 'label' && !this.string && this.node.children.length) {
this.string = this.node.children[0];
this.align = 'left';
}
if (this.node.tag == 'label' && (this.align === 'left' || this.node.attrs.colspan || (this.string && this.string.length > 32))) {
this.template = "WidgetParagraph";
this.colspan = parseInt(this.node.attrs.colspan || 1, 10);
@ -1205,6 +1210,8 @@ openerp.web.form.WidgetLabel = openerp.web.form.Widget.extend({
if (isNaN(parseFloat(this.node.attrs.align))) {
this.align = 'left';
}
this.multilines = this.string && _.str.lines(this.string).length > 1;
} else {
this.colspan = 1;
this.width = '1%';

View File

@ -929,7 +929,7 @@
</ul>
</t>
<t t-name="WidgetParagraph">
<p t-attf-class="oe_form_paragraph oe_align_#{widget.align}"><t t-esc="widget.string"/></p>
<p t-attf-class="oe_form_paragraph oe_align_#{widget.align} #{widget.multilines ? 'oe_multilines' : ''}"><t t-esc="widget.string"/></p>
</t>
<t t-name="FieldChar">
<input t-att-type="widget.password ? 'password' : 'text'" size="1"