signalr cleanup

This commit is contained in:
kay.one 2013-09-10 23:33:47 -07:00 committed by Keivan Beigi
parent feda4a9b67
commit 25e2c98c45
219 changed files with 2035 additions and 1495 deletions

View file

@ -3,9 +3,9 @@ define(
[
'app',
'marionette',
'Shared/Actioneer',
'Shared/Messenger'
], function (App, Marionette, Actioneer, Messenger) {
'Commands/CommandController',
'Shared/Actioneer'
], function (App, Marionette, CommandController, Actioneer) {
return Marionette.ItemView.extend({
template : 'Shared/Toolbar/ButtonTemplate',
@ -15,13 +15,8 @@ define(
'click': 'onClick'
},
ui: {
icon: '.x-icon'
},
initialize: function () {
this.storageKey = this.model.get('menuKey') + ':' + this.model.get('key');
this.idle = true;
},
onRender: function () {
@ -30,33 +25,34 @@ define(
this.invokeCallback();
}
if(!this.model.get('title')){
if (!this.model.get('title')) {
this.$el.addClass('btn-icon-only');
}
var command = this.model.get('command');
if (command) {
Actioneer.bindToCommand({
command: {name: command},
element: this.$el
});
}
},
onClick: function () {
if (this.idle) {
this.invokeCallback();
this.invokeRoute();
this.invokeCommand();
if (this.$el.hasClass('disabled')) {
return;
}
this.invokeCallback();
this.invokeRoute();
this.invokeCommand();
},
invokeCommand: function () {
var command = this.model.get('command');
if (command) {
this.idle = false;
Actioneer.ExecuteCommand({
command : command,
button : this.$el,
element : this.ui.icon,
errorMessage : this.model.get('errorMessage'),
successMessage: this.model.get('successMessage'),
always : this._commandAlways,
context : this
});
CommandController.Execute(command);
}
},
@ -83,12 +79,6 @@ define(
if (callback) {
callback.call(this.model.ownerContext);
}
},
_commandAlways: function () {
if (!this.isClosed) {
this.idle = true;
}
}
});
});