Christophe (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-labelmultilines-chs into lp:openerp-web.

Requested reviews:
  OpenERP R&D Web Team (openerp-dev-web)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-labelmultilines-chs/+merge/91856
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-labelmultilines-chs/+merge/91856
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-labelmultilines-chs.
=== modified file 'addons/web/static/src/css/base.css'
--- addons/web/static/src/css/base.css	2012-02-06 11:28:16 +0000
+++ addons/web/static/src/css/base.css	2012-02-07 15:37:15 +0000
@@ -1307,6 +1307,10 @@
     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;

=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js	2012-02-07 13:01:25 +0000
+++ addons/web/static/src/js/view_form.js	2012-02-07 15:37:15 +0000
@@ -1176,6 +1176,11 @@
 
         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.form_template = "WidgetParagraph";
             this.colspan = parseInt(this.node.attrs.colspan || 1, 10);
@@ -1184,6 +1189,8 @@
             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%';

=== modified file 'addons/web/static/src/xml/base.xml'
--- addons/web/static/src/xml/base.xml	2012-02-07 14:31:16 +0000
+++ addons/web/static/src/xml/base.xml	2012-02-07 15:37:15 +0000
@@ -927,7 +927,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"

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to