Added series stats to footer

pull/2/head
Mark McDowall 12 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' 'marionette'
], function (Marionette) { ], function (Marionette) {
return Marionette.CompositeView.extend({ 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', 'Cells/QualityProfileCell',
'Series/Index/Table/SeriesStatusCell', 'Series/Index/Table/SeriesStatusCell',
'Series/Index/Table/Row', 'Series/Index/Table/Row',
'Series/Index/LegendView', 'Series/Index/FooterView',
'Series/Index/FooterModel',
'Shared/Toolbar/ToolbarLayout', 'Shared/Toolbar/ToolbarLayout',
'Shared/LoadingView' 'Shared/LoadingView'
], function (Marionette, ], function (Marionette,
@ -26,7 +27,8 @@ define(
QualityProfileCell, QualityProfileCell,
SeriesStatusCell, SeriesStatusCell,
SeriesIndexRow, SeriesIndexRow,
LegendView, FooterView,
FooterModel,
ToolbarLayout, ToolbarLayout,
LoadingView) { LoadingView) {
return Marionette.Layout.extend({ return Marionette.Layout.extend({
@ -35,7 +37,7 @@ define(
regions: { regions: {
seriesRegion: '#x-series', seriesRegion: '#x-series',
toolbar : '#x-toolbar', toolbar : '#x-toolbar',
legend : '#x-legend' footer : '#x-series-footer'
}, },
columns: columns:
@ -155,9 +157,9 @@ define(
else { else {
this.currentView.collection = SeriesCollection; this.currentView.collection = SeriesCollection;
this.seriesRegion.show(this.currentView); this.seriesRegion.show(this.currentView);
this.legend.show(new LegendView());
this._showToolbar(); this._showToolbar();
this._showFooter();
} }
}, },
@ -168,7 +170,6 @@ define(
this._fetchCollection(); this._fetchCollection();
}, },
_fetchCollection: function () { _fetchCollection: function () {
if (SeriesCollection.length === 0) { if (SeriesCollection.length === 0) {
this.seriesRegion.show(new LoadingView()); this.seriesRegion.show(new LoadingView());
@ -225,6 +226,25 @@ define(
], ],
context: this 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 id="x-toolbar"></div>
<div class="row"> <div class="row">
<div class="span12"> <div class="span12">
<div id="x-series"></div> <div id="x-series"></div>
</div> </div>
</div> </div>
<div class="row">
<div class="span12"> <div id="x-series-footer"></div>
<div id="x-legend"></div>
</div>
</div>

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