define(function(require) {
'use strict';
+/* globals gettext */
var $ = require('libs/jquery'),
Backbone = require('libs/backbone'),
var actionState = this.action.getState();
+ if(!actionState) {
+ this.$el.html(buttonTemplate({label: gettext('error :('), iconName:''}));
+ this._button().attr('disabled', true);
+ return;
+ }
+
var templateContext = {
label: actionState.label || '?',
iconName: (iconExists(actionState.icon)) ? actionState.icon : null,
this.trigger('mousedown');
},
onExecute: function() {
- var ret = this.action.execute();
- this.trigger('actionExecuted', this.action, ret);
+ this.action.execute(function(ret) {
+ this.trigger('actionExecuted', this.action, ret);
+ }.bind(this));
},
onSelectionChange: function(e) {
var select = $(e.target),