From 2c519a7dcd5d30f02a00ab54a26d771f873e5776 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 22 May 2013 23:25:58 -0700 Subject: [PATCH] Added spinner to add series buttons --- UI/AddSeries/Existing/ImportSeriesView.js | 9 ++++++++- .../Existing/UnmappedFolderCompositeViewTemplate.html | 2 +- UI/AddSeries/New/SearchResultView.js | 6 ++++++ UI/AddSeries/SearchResultTemplate.html | 4 +++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/UI/AddSeries/Existing/ImportSeriesView.js b/UI/AddSeries/Existing/ImportSeriesView.js index e28bef216..0816ec5a7 100644 --- a/UI/AddSeries/Existing/ImportSeriesView.js +++ b/UI/AddSeries/Existing/ImportSeriesView.js @@ -10,7 +10,8 @@ define([ template: 'AddSeries/SearchResultTemplate', ui: { - qualityProfile: '.x-quality-profile' + qualityProfile: '.x-quality-profile', + addButton : '.x-add' }, events: { @@ -22,6 +23,8 @@ define([ }, addSeries: function () { + var icon = this.ui.addButton.find('icon'); + icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled'); var self = this; @@ -35,6 +38,7 @@ define([ this.model.save(undefined, { success: function () { + icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); NzbDrone.Shared.Messenger.show({ message: 'Added: ' + self.model.get('title') }); @@ -42,6 +46,9 @@ define([ NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: true, series: self.model }); self.trigger('seriesAdded'); self.close(); + }, + fail: function () { + icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); } }); } diff --git a/UI/AddSeries/Existing/UnmappedFolderCompositeViewTemplate.html b/UI/AddSeries/Existing/UnmappedFolderCompositeViewTemplate.html index 914dfc476..071fb4fde 100644 --- a/UI/AddSeries/Existing/UnmappedFolderCompositeViewTemplate.html +++ b/UI/AddSeries/Existing/UnmappedFolderCompositeViewTemplate.html @@ -7,7 +7,7 @@ diff --git a/UI/AddSeries/New/SearchResultView.js b/UI/AddSeries/New/SearchResultView.js index ea2a73578..b48b3778c 100644 --- a/UI/AddSeries/New/SearchResultView.js +++ b/UI/AddSeries/New/SearchResultView.js @@ -20,6 +20,8 @@ define(['app', 'Series/SeriesCollection'], function (app) { }, 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 rootFolderId = this.ui.rootFolder.val(); @@ -32,11 +34,15 @@ define(['app', 'Series/SeriesCollection'], function (app) { this.model.save(undefined, { url : NzbDrone.Series.SeriesCollection.prototype.url, success: function () { + icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); NzbDrone.Shared.Messenger.show({ message: 'Added: ' + self.model.get('title') }); NzbDrone.vent.trigger(NzbDrone.Events.SeriesAdded, { existing: false, series: self.model }); + }, + fail: function () { + icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); } }); } diff --git a/UI/AddSeries/SearchResultTemplate.html b/UI/AddSeries/SearchResultTemplate.html index 06ee6bd96..e3d330d87 100644 --- a/UI/AddSeries/SearchResultTemplate.html +++ b/UI/AddSeries/SearchResultTemplate.html @@ -21,7 +21,9 @@ {{/each}} -
+
+ +

{{title}}