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

View File

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

View File

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

View File

@ -82,7 +82,7 @@ define(
this.series = options.series; this.series = options.series;
this.showingEpisodes = this._shouldShowEpisodes(); this.showingEpisodes = this._shouldShowEpisodes();
this.templateHelpers.showingEpisodes = this.showingEpisodes; this._generateTemplateHelpers();
this.listenTo(this.model, 'sync', function () { this.listenTo(this.model, 'sync', function () {
this._afterSeasonMonitored(); this._afterSeasonMonitored();
@ -198,6 +198,25 @@ define(
return result; 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 () { _showHideEpisodes: function () {
if (this.showingEpisodes) { if (this.showingEpisodes) {
this.showingEpisodes = false; this.showingEpisodes = false;

View File

@ -8,6 +8,16 @@
Specials Specials
{{/if}} {{/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"> <span class="season-actions pull-right">
<i class="icon-nd-rename x-season-rename" title="Rename all episodes in season {{seasonNumber}}"/> <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}}"/> <i class="icon-search x-season-search" title="Search for all episodes in season {{seasonNumber}}"/>

View File

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