Season status icon added to seasons on series details

pull/4/head
Mark McDowall 11 years ago
parent 4bcd5ce5c6
commit 7c72e1e865

@ -109,4 +109,8 @@
.icon-nd-imported:before {
.icon(@download-alt);
}
.icon-nd-status:before {
.icon(@circle);
}

@ -149,3 +149,15 @@ footer {
padding-right : 5px;
}
}
.status-primary {
color: @linkColor;
}
.status-success {
color: @successText;
}
.status-danger {
color: @errorText;
}

@ -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;

@ -8,6 +8,16 @@
Specials
{{/if}}
{{#if_eq episodeCount compare=0}}
<i class="icon-nd-status season-status status-primary" title="No aired episodes"/>
{{else}}
{{#if_eq percentOfEpisodes compare=100}}
<i class="icon-nd-status season-status status-success" title="{{episodeFileCount}}/{{episodeCount}} episodes downloaded"/>
{{else}}
<i class="icon-nd-status season-status status-danger" title="{{episodeFileCount}}/{{episodeCount}} episodes downloaded"/>
{{/if_eq}}
{{/if_eq}}
<span class="season-actions pull-right">
<i class="icon-nd-rename x-season-rename" title="Rename all episodes in season {{seasonNumber}}"/>
<i class="icon-search x-season-search" title="Search for all episodes in season {{seasonNumber}}"/>

@ -262,3 +262,8 @@
margin-top: 10px;
}
}
.season-status {
font-size: 16px;
vertical-align: middle !important;
}
Loading…
Cancel
Save