mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-13 08:33:58 -07:00
signalr cleanup
This commit is contained in:
parent
feda4a9b67
commit
25e2c98c45
219 changed files with 2035 additions and 1495 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue