[FIX] web: form_view: WidgetButton

Buttons that are not stat buttons couldn't use font-awesome icons, as it
automatically fallbacked on the icons in /web/static/src/img/icons. This was
the case for several templates where the icon thus couldn't be found as it was
looking for a font-awesome icon in the icons folder (e.g. fa-cog.png).

Also cleans some unused less rules defined on the stat buttons in
enterprise_compatibility.less
This commit is contained in:
Aaron Bohy
2015-08-04 12:16:17 +02:00
parent 5ebcc01fda
commit 37f5875ea5
5 changed files with 14 additions and 28 deletions
+1 -1
View File
@@ -387,7 +387,7 @@
padding: 0;
line-height: 120%;
}
.openerp .oe_stat_button .stat_button_icon {
.openerp .oe_stat_button .o_button_icon {
color: #7C7BAD;
font-size: 24px;
padding: 0px 3px;
+1 -1
View File
@@ -394,7 +394,7 @@ $sheet-padding: 16px
text-align: left
padding: 0
line-height: 120%
.stat_button_icon
.o_button_icon
color: #7C7BAD
font-size: 24px
padding: 0px 3px
@@ -23,8 +23,6 @@ var WidgetButton = common.FormWidget.extend({
template: 'WidgetButton',
init: function(field_manager, node) {
node.attrs.type = node.attrs['data-button-type'];
this.is_stat_button = /\boe_stat_button\b/.test(node.attrs['class']);
this.icon_class = node.attrs.icon && "stat_button_icon fa " + node.attrs.icon + " fa-fw";
this._super(field_manager, node);
this.force_disabled = false;
this.string = (this.node.attrs.string || '').replace(/_/g, '');
@@ -32,8 +30,12 @@ var WidgetButton = common.FormWidget.extend({
// TODO fme: provide enter key binding to widgets
this.view.default_focus_button = this;
}
if (this.node.attrs.icon && (! /\//.test(this.node.attrs.icon))) {
this.node.attrs.icon = '/web/static/src/img/icons/' + this.node.attrs.icon + '.png';
if (this.node.attrs.icon) {
// if the icon isn't a font-awesome one, find it in the icons folder
this.fa_icon = this.node.attrs.icon.indexOf('fa-') === 0;
if (!this.fa_icon && (! /\//.test(this.node.attrs.icon))) {
this.node.attrs.icon = '/web/static/src/img/icons/' + this.node.attrs.icon + '.png';
}
}
},
start: function() {
@@ -167,35 +167,18 @@ div.o_checkbox {
.openerp .oe_formview {
.oe_button_box {
.oe_stat_button {
.stat_button_icon {
display: inline-block;
}
// padding: @odoo-statbutton-vpadding @odoo-statbutton-spacing @odoo-statbutton-vpadding 0px;
text-align: left;
.o_button_icon {
// margin-left: @odoo-statbutton-spacing; // To create the button padding left (firefox bug)
width: 30%;
display: inline-block;
vertical-align: middle;
&:before {
font-size: x-large;
vertical-align: middle;
}
width: 30%;
}
// .o_form_field_percent_pie {
// margin-left: @odoo-statbutton-spacing; // To create the button padding left (firefox bug)
// }
.o_stat_info { // contains the value and text
display: inline-block;
vertical-align: middle;
max-width: 70%;
// padding-right: @odoo-statbutton-spacing;
line-height: 1.2;
.o_stat_value {
+5 -4
View File
@@ -1153,10 +1153,11 @@
t-att-tabindex="widget.node.attrs.tabindex"
t-att-autofocus="widget.node.attrs.autofocus"
t-att-accesskey="widget.node.attrs.accesskey">
<img t-if="!widget.is_stat_button and widget.node.attrs.icon " t-att-src="_s + widget.node.attrs.icon" width="16" height="16"/>
<div t-if="widget.is_stat_button and widget.icon_class" t-att-class="widget.icon_class"></div>
<span t-if="widget.string and !widget.is_stat_button"><t t-esc="widget.string"/></span>
<div t-if="widget.string and widget.is_stat_button" class="o_stat_info"><t t-esc="widget.string"/></div>
<t t-if="widget.node.attrs.icon">
<img t-if="!widget.fa_icon" t-att-src="widget.node.attrs.icon"/>
<div t-if="widget.fa_icon" t-attf-class="fa fa-fw #{widget.node.attrs.icon} o_button_icon"/>
</t>
<span t-if="widget.string"><t t-esc="widget.string"/></span>
</button>
</t>
<t t-name="WidgetButton.tooltip" t-extend="WidgetLabel.tooltip">