summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/form_widgets.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2015-08-03 14:39:19 +0200
committerAaron Bohy <aab@odoo.com>2015-08-04 12:16:17 +0200
commit37f5875ea5d11257e6abfb0a3de42ad19d57a3d3 (patch)
treeae22fa471eb2558845b55210903194cbd189ac45 /addons/web/static/src/js/views/form_widgets.js
parent5ebcc01fda2f102486ac68809655630668e6fd59 (diff)
[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
Diffstat (limited to 'addons/web/static/src/js/views/form_widgets.js')
-rw-r--r--addons/web/static/src/js/views/form_widgets.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js
index bda63d57fc2..7d007981484 100644
--- a/addons/web/static/src/js/views/form_widgets.js
+++ b/addons/web/static/src/js/views/form_widgets.js
@@ -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() {