More details in series footer

This commit is contained in:
Mark McDowall 2013-07-28 18:32:52 -07:00
parent 74a4def877
commit 837626fda3
2 changed files with 57 additions and 16 deletions

View File

@ -7,15 +7,36 @@
</ul> </ul>
</div> </div>
<div class="series-stats span3"> <div class="series-stats span2">
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt>Series</dt> <dt>Series</dt>
<dd>{{count}}</dd> <dd>{{series}}</dd>
<dt>Episodes</dt>
<dd>{{episodeCount}}</dd>
<dt>Files</dt>
<dd>{{episodeFileCount}}</dd>
</dl>
<dt>Ended</dt>
<dd>{{ended}}</dd>
<dt>Continuing</dt>
<dd>{{continuing}}</dd>
</dl>
</div>
<div class="series-stats span2">
<dl class="dl-horizontal">
<dt>Monitored</dt>
<dd>{{monitored}}</dd>
<dt>Unmonitored</dt>
<dd>{{unmonitored}}</dd>
</dl>
</div>
<div class="series-stats span2">
<dl class="dl-horizontal">
<dt>Episodes</dt>
<dd>{{episodes}}</dd>
<dt>Files</dt>
<dd>{{episodeFiles}}</dd>
</dl>
</div> </div>
</div> </div>

View File

@ -230,18 +230,38 @@ define(
_showFooter: function () { _showFooter: function () {
var footerModel = new FooterModel(); var footerModel = new FooterModel();
var episodeCount = _.reduce(SeriesCollection.models, function (memo, model) { var series = SeriesCollection.models.length;
return memo + model.get('episodeCount'); var episodes = 0;
}, 0); var episodeFiles = 0;
var ended = 0;
var continuing = 0;
var monitored = 0;
var episodeFileCount = _.reduce(SeriesCollection.models, function (memo, model) { _.each(SeriesCollection.models, function (model){
return memo + model.get('episodeFileCount'); episodes += model.get('episodeCount');
}, 0); episodeFiles += model.get('episodeFileCount');
if (model.get('status').toLowerCase() === 'ended') {
ended++;
}
else {
continuing++;
}
if (model.get('monitored')) {
monitored++;
}
});
footerModel.set({ footerModel.set({
count: SeriesCollection.models.length, series: series,
episodeCount: episodeCount, ended: ended,
episodeFileCount: episodeFileCount continuing: continuing,
monitored: monitored,
unmonitored: series - monitored,
episodes: episodes,
episodeFiles: episodeFiles
}); });
this.footer.show(new FooterView({ model: footerModel })); this.footer.show(new FooterView({ model: footerModel }));