Added series stats to footer

pull/25/head
Mark McDowall 11 years ago
parent 708cb954c4
commit 74a4def877

@ -0,0 +1,9 @@
'use strict';
define(
[
'backbone',
'underscore'
], function (Backbone, _) {
return Backbone.Model.extend({
});
});

@ -4,6 +4,6 @@ define(
'marionette'
], function (Marionette) {
return Marionette.CompositeView.extend({
template: 'Series/Index/LegendViewTemplate'
template: 'Series/Index/FooterViewTemplate'
});
});

@ -0,0 +1,21 @@
<div class="row">
<div class="series-legend legend span3">
<ul class='legend-labels'>
<li><span class="progress-primary"></span>Continuing (All Episodes downloaded)</li>
<li><span class="progress-success"></span>Ended (All Episodes downloaded)</li>
<li><span class="progress-danger"></span>Missing Episodes</li>
</ul>
</div>
<div class="series-stats span3">
<dl class="dl-horizontal">
<dt>Series</dt>
<dd>{{count}}</dd>
<dt>Episodes</dt>
<dd>{{episodeCount}}</dd>
<dt>Files</dt>
<dd>{{episodeFileCount}}</dd>
</dl>
</div>
</div>

@ -1,7 +0,0 @@
<div class="legend">
<ul class='legend-labels'>
<li><span class="progress-primary"></span>Continuing (All Episodes downloaded)</li>
<li><span class="progress-success"></span>Ended (All Episodes downloaded)</li>
<li><span class="progress-danger"></span>Missing Episodes</li>
</ul>
</div>

@ -12,7 +12,8 @@ define(
'Cells/QualityProfileCell',
'Series/Index/Table/SeriesStatusCell',
'Series/Index/Table/Row',
'Series/Index/LegendView',
'Series/Index/FooterView',
'Series/Index/FooterModel',
'Shared/Toolbar/ToolbarLayout',
'Shared/LoadingView'
], function (Marionette,
@ -26,7 +27,8 @@ define(
QualityProfileCell,
SeriesStatusCell,
SeriesIndexRow,
LegendView,
FooterView,
FooterModel,
ToolbarLayout,
LoadingView) {
return Marionette.Layout.extend({
@ -35,7 +37,7 @@ define(
regions: {
seriesRegion: '#x-series',
toolbar : '#x-toolbar',
legend : '#x-legend'
footer : '#x-series-footer'
},
columns:
@ -155,9 +157,9 @@ define(
else {
this.currentView.collection = SeriesCollection;
this.seriesRegion.show(this.currentView);
this.legend.show(new LegendView());
this._showToolbar();
this._showFooter();
}
},
@ -168,7 +170,6 @@ define(
this._fetchCollection();
},
_fetchCollection: function () {
if (SeriesCollection.length === 0) {
this.seriesRegion.show(new LoadingView());
@ -225,6 +226,25 @@ define(
],
context: this
}));
},
_showFooter: function () {
var footerModel = new FooterModel();
var episodeCount = _.reduce(SeriesCollection.models, function (memo, model) {
return memo + model.get('episodeCount');
}, 0);
var episodeFileCount = _.reduce(SeriesCollection.models, function (memo, model) {
return memo + model.get('episodeFileCount');
}, 0);
footerModel.set({
count: SeriesCollection.models.length,
episodeCount: episodeCount,
episodeFileCount: episodeFileCount
});
this.footer.show(new FooterView({ model: footerModel }));
}
});
});

@ -1,11 +1,9 @@
<div id="x-toolbar"></div>
<div class="row">
<div class="span12">
<div id="x-series"></div>
</div>
</div>
<div class="row">
<div class="span12">
<div id="x-legend"></div>
</div>
</div>
<div id="x-series-footer"></div>

@ -221,3 +221,10 @@
}
}
.series-stats {
font-size: 11px;
}
.series-legend {
padding-top: 5px;
}
Loading…
Cancel
Save