Seasons will reload when series info is refreshed

This commit is contained in:
Mark McDowall 2013-08-04 12:30:04 -07:00
parent 1ef168370e
commit 694714726c
2 changed files with 27 additions and 22 deletions

View File

@ -49,8 +49,6 @@ define(
}, },
onShow: function () { onShow: function () {
var self = this;
var fanArt = this._getFanArt(); var fanArt = this._getFanArt();
if (fanArt) { if (fanArt) {
@ -60,24 +58,7 @@ define(
$('body').removeClass('backdrop'); $('body').removeClass('backdrop');
} }
this.seasons.show(new LoadingView()); this._showSeasons();
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._setMonitoredState(); this._setMonitoredState();
}, },
@ -133,7 +114,9 @@ define(
seriesId: this.model.get('id') seriesId: this.model.get('id')
}, },
element : this.ui.refresh, element : this.ui.refresh,
leaveIcon : true leaveIcon : true,
context: this,
successCallback: this._showSeasons
}); });
}, },
@ -165,6 +148,28 @@ define(
failMessage : 'Series search failed', failMessage : 'Series search failed',
startMessage: 'Search for {0} started'.format(this.model.get('title')) 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
}));
});
} }
}); });
}); });

View File

@ -30,7 +30,7 @@ define(['Commands/CommandController', 'Shared/Messenger'],
}); });
} }
if (options.succesCallback) { if (options.successCallback) {
options.successCallback.call(options.context); options.successCallback.call(options.context);
} }
}); });