[FIX] support arbitrary icons

bzr revid: al@openerp.com-20120726005835-g1l6kg8yge225fd8
This commit is contained in:
Antony Lesuisse 2012-07-26 02:58:35 +02:00
parent 3a793019b6
commit 3a6f429d0d
2 changed files with 4 additions and 1 deletions

View File

@ -1654,6 +1654,9 @@ instance.web.form.WidgetButton = instance.web.form.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';
}
this.view.on('view_content_has_changed', this, this.check_disable);
},
start: function() {

View File

@ -1133,7 +1133,7 @@
t-att-style="widget.node.attrs.style"
t-att-tabindex="widget.node.attrs.tabindex"
t-att-autofocus="widget.node.attrs.autofocus">
<img t-if="widget.node.attrs.icon" t-att-src="_s + '/web/static/src/img/icons/' + widget.node.attrs.icon + '.png'" width="16" height="16"/>
<img t-if="widget.node.attrs.icon" t-att-src="_s + widget.node.attrs.icon" width="16" height="16"/>
<span t-if="widget.string"><t t-esc="widget.string"/></span>
</button>
</t>