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 () {
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
}));
});
}
});
});

View File

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