From 694714726c2aa7455a45e6a8c3ab0ed195a34815 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 4 Aug 2013 12:30:04 -0700 Subject: [PATCH] Seasons will reload when series info is refreshed --- UI/Series/Details/SeriesDetailsLayout.js | 47 +++++++++++++----------- UI/Shared/Actioneer.js | 2 +- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/UI/Series/Details/SeriesDetailsLayout.js b/UI/Series/Details/SeriesDetailsLayout.js index abfd30181..9e16c6000 100644 --- a/UI/Series/Details/SeriesDetailsLayout.js +++ b/UI/Series/Details/SeriesDetailsLayout.js @@ -49,8 +49,6 @@ define( }, onShow: function () { - var self = this; - var fanArt = this._getFanArt(); if (fanArt) { @@ -60,24 +58,7 @@ define( $('body').removeClass('backdrop'); } - this.seasons.show(new LoadingView()); - - this.seasonCollection = new SeasonCollection(); - this.episodeCollection = new EpisodeCollection(); - - $.when(this.episodeCollection.fetch({data: { seriesId: this.model.id }}), this.seasonCollection.fetch({data: { seriesId: this.model.id }})).done(function () { - self.seasons.show(new SeasonCollectionView({ - collection : self.seasonCollection, - episodeCollection: self.episodeCollection, - series : self.model - })); - - self.seasonMenu.show(new SeasonMenuCollectionView({ - collection: self.seasonCollection, - episodeCollection: self.episodeCollection - })); - }); - + this._showSeasons(); this._setMonitoredState(); }, @@ -133,7 +114,9 @@ define( seriesId: this.model.get('id') }, element : this.ui.refresh, - leaveIcon : true + leaveIcon : true, + context: this, + successCallback: this._showSeasons }); }, @@ -165,6 +148,28 @@ define( failMessage : 'Series search failed', startMessage: 'Search for {0} started'.format(this.model.get('title')) }); + }, + + _showSeasons: function () { + var self = this; + + this.seasons.show(new LoadingView()); + + this.seasonCollection = new SeasonCollection(); + this.episodeCollection = new EpisodeCollection(); + + $.when(this.episodeCollection.fetch({data: { seriesId: this.model.id }}), this.seasonCollection.fetch({data: { seriesId: this.model.id }})).done(function () { + self.seasons.show(new SeasonCollectionView({ + collection : self.seasonCollection, + episodeCollection: self.episodeCollection, + series : self.model + })); + + self.seasonMenu.show(new SeasonMenuCollectionView({ + collection: self.seasonCollection, + episodeCollection: self.episodeCollection + })); + }); } }); }); diff --git a/UI/Shared/Actioneer.js b/UI/Shared/Actioneer.js index 2c54fb37c..f7d857dfc 100644 --- a/UI/Shared/Actioneer.js +++ b/UI/Shared/Actioneer.js @@ -30,7 +30,7 @@ define(['Commands/CommandController', 'Shared/Messenger'], }); } - if (options.succesCallback) { + if (options.successCallback) { options.successCallback.call(options.context); } });