Season status icon added to seasons on series details

This commit is contained in:
Mark McDowall
2013-09-04 23:33:06 -07:00
parent 4bcd5ce5c6
commit 7c72e1e865
5 changed files with 51 additions and 1 deletions
+20 -1
View File
@@ -82,7 +82,7 @@ define(
this.series = options.series;
this.showingEpisodes = this._shouldShowEpisodes();
this.templateHelpers.showingEpisodes = this.showingEpisodes;
this._generateTemplateHelpers();
this.listenTo(this.model, 'sync', function () {
this._afterSeasonMonitored();
@@ -198,6 +198,25 @@ define(
return result;
},
_generateTemplateHelpers: function () {
this.templateHelpers.showingEpisodes = this.showingEpisodes;
var episodeCount = this.episodeCollection.filter(function (episode) {
return (episode.get('monitored') && Moment(episode.get('airDateUtc')).isBefore(Moment())) || episode.get('hasFile');
}).length;
var episodeFileCount = this.episodeCollection.where({ hasFile: true }).length;
var percentOfEpisodes = 100;
if (episodeCount > 0) {
percentOfEpisodes = episodeFileCount / episodeCount * 100;
}
this.templateHelpers.episodeCount = episodeCount;
this.templateHelpers.episodeFileCount = episodeFileCount;
this.templateHelpers.percentOfEpisodes = percentOfEpisodes;
},
_showHideEpisodes: function () {
if (this.showingEpisodes) {
this.showingEpisodes = false;