Added spinner to add series buttons

This commit is contained in:
Mark McDowall 2013-05-22 23:25:58 -07:00
parent 8713ebefd6
commit 2c519a7dcd
4 changed files with 18 additions and 3 deletions

View File

@ -10,7 +10,8 @@ define([
template: 'AddSeries/SearchResultTemplate', template: 'AddSeries/SearchResultTemplate',
ui: { ui: {
qualityProfile: '.x-quality-profile' qualityProfile: '.x-quality-profile',
addButton : '.x-add'
}, },
events: { events: {
@ -22,6 +23,8 @@ define([
}, },
addSeries: function () { addSeries: function () {
var icon = this.ui.addButton.find('icon');
icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled');
var self = this; var self = this;
@ -35,6 +38,7 @@ define([
this.model.save(undefined, { this.model.save(undefined, {
success: function () { success: function () {
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
NzbDrone.Shared.Messenger.show({ NzbDrone.Shared.Messenger.show({
message: 'Added: ' + self.model.get('title') message: 'Added: ' + self.model.get('title')
}); });
@ -42,6 +46,9 @@ define([
NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: true, series: self.model }); NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: true, series: self.model });
self.trigger('seriesAdded'); self.trigger('seriesAdded');
self.close(); self.close();
},
fail: function () {
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
} }
}); });
} }

View File

@ -20,6 +20,8 @@ define(['app', 'Series/SeriesCollection'], function (app) {
}, },
addSeries: function () { addSeries: function () {
var icon = this.ui.addButton.find('icon');
icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled');
var quality = this.ui.qualityProfile.val(); var quality = this.ui.qualityProfile.val();
var rootFolderId = this.ui.rootFolder.val(); var rootFolderId = this.ui.rootFolder.val();
@ -32,11 +34,15 @@ define(['app', 'Series/SeriesCollection'], function (app) {
this.model.save(undefined, { this.model.save(undefined, {
url : NzbDrone.Series.SeriesCollection.prototype.url, url : NzbDrone.Series.SeriesCollection.prototype.url,
success: function () { success: function () {
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
NzbDrone.Shared.Messenger.show({ NzbDrone.Shared.Messenger.show({
message: 'Added: ' + self.model.get('title') message: 'Added: ' + self.model.get('title')
}); });
NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: false, series: self.model }); NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: false, series: self.model });
},
fail: function () {
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
} }
}); });
} }

View File

@ -21,7 +21,9 @@
{{/each}} {{/each}}
</select> </select>
<div class="btn btn-success icon-plus x-add pull-right"/> <div class="btn btn-success x-add pull-right">
<icon class="icon-plus"></icon>
</div>
</div> </div>
<div class="row"> <div class="row">
<h2>{{title}}</h2> <h2>{{title}}</h2>