Spinner on add series buttons

pull/6/head
Mark McDowall 10 years ago
parent 66a9cddf01
commit e6566b26d8

@ -39,6 +39,7 @@ define(
monitor : '.x-monitor', monitor : '.x-monitor',
monitorTooltip : '.x-monitor-tooltip', monitorTooltip : '.x-monitor-tooltip',
addButton : '.x-add', addButton : '.x-add',
addSearchButton : '.x-add-search',
overview : '.x-overview' overview : '.x-overview'
}, },
@ -184,8 +185,8 @@ define(
}, },
_addSeries: function (searchForMissingEpisodes) { _addSeries: function (searchForMissingEpisodes) {
var icon = this.ui.addButton.find('icon'); this.ui.addButton.addClass('disabled');
icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled'); this.ui.addSearchButton.addClass('disabled');
var profile = this.ui.profile.val(); var profile = this.ui.profile.val();
var rootFolderPath = this.ui.rootFolder.children(':selected').text(); var rootFolderPath = this.ui.rootFolder.children(':selected').text();
@ -206,11 +207,23 @@ define(
var self = this; var self = this;
var promise = this.model.save(); var promise = this.model.save();
if (searchForMissingEpisodes) {
this.ui.addSearchButton.spinForPromise(promise);
}
else {
this.ui.addButton.spinForPromise(promise);
}
promise.always(function () {
self.ui.addButton.removeClass('disabled');
self.ui.addSearchButton.removeClass('disabled');
});
promise.done(function () { promise.done(function () {
SeriesCollection.add(self.model); SeriesCollection.add(self.model);
self.close(); self.close();
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
Messenger.show({ Messenger.show({
message: 'Added: ' + self.model.get('title'), message: 'Added: ' + self.model.get('title'),

Loading…
Cancel
Save