[FIX] Add support for @align attribute in form views
lp bug: https://launchpad.net/bugs/844625 fixed bzr revid: fme@openerp.com-20111027124325-ckd8kuujbb591nqu
This commit is contained in:
parent
ecfa2d532e
commit
66ea543974
|
@ -874,7 +874,6 @@ label.error {
|
|||
}
|
||||
|
||||
.openerp .oe_forms label.oe_label, .openerp .oe_forms label.oe_label_help {
|
||||
text-align: right;
|
||||
margin: 3px 0 0 10px;
|
||||
}
|
||||
.openerp label.oe_label_help span {
|
||||
|
@ -885,6 +884,18 @@ label.error {
|
|||
top: -4px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
.openerp .oe_align_left {
|
||||
text-align: left;
|
||||
}
|
||||
.openerp .oe_align_right {
|
||||
text-align: right;
|
||||
}
|
||||
.openerp .oe_align_center {
|
||||
text-align: center;
|
||||
}
|
||||
.openerp .oe_forms .oe_form_paragraph {
|
||||
margin: 3px 0 0 0;
|
||||
}
|
||||
|
||||
/* Inputs */
|
||||
.openerp .oe_forms input[type="text"], .openerp .oe_forms input[type="password"], .openerp .oe_forms select, .openerp .oe_forms textarea {
|
||||
|
|
|
@ -717,6 +717,16 @@ openerp.web.form.Widget = openerp.web.Widget.extend(/** @lends openerp.web.form.
|
|||
this.invisible = this.modifiers['invisible'] === true;
|
||||
this.classname = 'oe_form_' + this.type;
|
||||
|
||||
this.align = parseFloat(this.node.attrs.align);
|
||||
if (isNaN(this.align) || this.align === 1) {
|
||||
this.align = 'right';
|
||||
} else if (this.align === 0) {
|
||||
this.align = 'left';
|
||||
} else {
|
||||
this.align = 'center';
|
||||
}
|
||||
|
||||
|
||||
this.width = this.node.attrs.width;
|
||||
},
|
||||
start: function() {
|
||||
|
@ -1046,8 +1056,7 @@ openerp.web.form.WidgetLabel = openerp.web.form.Widget.extend({
|
|||
|
||||
this._super(view, node);
|
||||
|
||||
// TODO fme: support for attrs.align
|
||||
if (this.node.tag == 'label' && (this.node.attrs.colspan || (this.string && this.string.length > 32))) {
|
||||
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);
|
||||
} else {
|
||||
|
|
|
@ -752,7 +752,7 @@
|
|||
</t>
|
||||
<t t-name="WidgetLabel">
|
||||
<label t-att-for="widget.element_id"
|
||||
t-att-class="'oe_label' + (widget.help ? '_help' : '')"
|
||||
t-attf-class="oe_label#{widget.help ? '_help' : ''} oe_align_#{widget.align}"
|
||||
t-att-title="widget.help">
|
||||
<t t-esc="widget.string"/>
|
||||
<span t-if="widget.help">?</span>
|
||||
|
@ -760,7 +760,7 @@
|
|||
</label>
|
||||
</t>
|
||||
<t t-name="WidgetParagraph">
|
||||
<p class="oe_form_paragraph"><t t-esc="widget.string"/></p>
|
||||
<p t-attf-class="oe_form_paragraph oe_align_#{widget.align}"><t t-esc="widget.string"/></p>
|
||||
</t>
|
||||
<t t-name="FieldChar">
|
||||
<input t-att-type="widget.password ? 'password' : 'text'" size="1"
|
||||
|
|
Loading…
Reference in New Issue