From 837626fda3ec20203fa117218b436dfe5b8af618 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 28 Jul 2013 18:32:52 -0700 Subject: [PATCH] More details in series footer --- UI/Series/Index/FooterViewTemplate.html | 35 ++++++++++++++++++----- UI/Series/Index/SeriesIndexLayout.js | 38 +++++++++++++++++++------ 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/UI/Series/Index/FooterViewTemplate.html b/UI/Series/Index/FooterViewTemplate.html index e55cb7755..72e28d22b 100644 --- a/UI/Series/Index/FooterViewTemplate.html +++ b/UI/Series/Index/FooterViewTemplate.html @@ -7,15 +7,36 @@ -
+
Series
-
{{count}}
-
Episodes
-
{{episodeCount}}
-
Files
-
{{episodeFileCount}}
-
+
{{series}}
+
Ended
+
{{ended}}
+ +
Continuing
+
{{continuing}}
+ +
+ +
+
+
Monitored
+
{{monitored}}
+ +
Unmonitored
+
{{unmonitored}}
+
+
+ +
+
+
Episodes
+
{{episodes}}
+ +
Files
+
{{episodeFiles}}
+
diff --git a/UI/Series/Index/SeriesIndexLayout.js b/UI/Series/Index/SeriesIndexLayout.js index 8bfd57ef1..7d4738f60 100644 --- a/UI/Series/Index/SeriesIndexLayout.js +++ b/UI/Series/Index/SeriesIndexLayout.js @@ -230,18 +230,38 @@ define( _showFooter: function () { var footerModel = new FooterModel(); - var episodeCount = _.reduce(SeriesCollection.models, function (memo, model) { - return memo + model.get('episodeCount'); - }, 0); + var series = SeriesCollection.models.length; + var episodes = 0; + var episodeFiles = 0; + var ended = 0; + var continuing = 0; + var monitored = 0; - var episodeFileCount = _.reduce(SeriesCollection.models, function (memo, model) { - return memo + model.get('episodeFileCount'); - }, 0); + _.each(SeriesCollection.models, function (model){ + episodes += model.get('episodeCount'); + episodeFiles += model.get('episodeFileCount'); + + if (model.get('status').toLowerCase() === 'ended') { + ended++; + } + + else { + continuing++; + } + + if (model.get('monitored')) { + monitored++; + } + }); footerModel.set({ - count: SeriesCollection.models.length, - episodeCount: episodeCount, - episodeFileCount: episodeFileCount + series: series, + ended: ended, + continuing: continuing, + monitored: monitored, + unmonitored: series - monitored, + episodes: episodes, + episodeFiles: episodeFiles }); this.footer.show(new FooterView({ model: footerModel }));