diff options
| author | Fabien Meghazi <fme@openerp.com> | 2012-02-08 15:39:43 +0100 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2012-02-08 15:39:43 +0100 |
| commit | 7b3094ee8a755f078ce2493a46e1c0331d86e681 (patch) | |
| tree | 3e18028b71d00234409f17c4762ea7c62e11dc43 /addons/web/static/src | |
| parent | 289eba0e4fc4191b0c918e475cbfdd96f6153caa (diff) | |
| parent | 7d05f195d9de3ec158629931f646e9d86de7992f (diff) | |
[FIX] handle multilines in <label> tags of form views
bzr revid: fme@openerp.com-20120208143943-p6i12v8cd0ua831d
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/css/base.css | 4 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 7 | ||||
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index ce86eb889ea..cc3dfaed81a 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -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; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index f4749717a6b..114d8a6a189 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -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%'; diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 69c491c73a5..c1fdb3b7c92 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -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" |
