From ea43d78ad156f0d3c6301f6d667e8a723c998845 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 1 Nov 2014 23:20:41 -0700 Subject: [PATCH] Fixed: show proper episode file count on series details --- src/UI/Series/Details/InfoView.js | 11 ++++++++++- src/UI/Series/Details/InfoViewTemplate.hbs | 2 +- src/UI/Series/Details/SeriesDetailsLayout.js | 2 +- src/UI/Series/EpisodeFileCollection.js | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/UI/Series/Details/InfoView.js b/src/UI/Series/Details/InfoView.js index 60389b17d..a6992da8a 100644 --- a/src/UI/Series/Details/InfoView.js +++ b/src/UI/Series/Details/InfoView.js @@ -7,8 +7,17 @@ define( return Marionette.ItemView.extend({ template: 'Series/Details/InfoViewTemplate', - initialize: function () { + initialize: function (options) { + this.episodeFileCollection = options.episodeFileCollection; + this.listenTo(this.model, 'change', this.render); + this.listenTo(this.episodeFileCollection, 'sync', this.render); + }, + + templateHelpers: function() { + return { + fileCount: this.episodeFileCollection.length + }; } }); }); diff --git a/src/UI/Series/Details/InfoViewTemplate.hbs b/src/UI/Series/Details/InfoViewTemplate.hbs index fdf2e1b86..843aaf2ef 100644 --- a/src/UI/Series/Details/InfoViewTemplate.hbs +++ b/src/UI/Series/Details/InfoViewTemplate.hbs @@ -5,7 +5,7 @@ {{runtime}} minutes {{path}} {{Bytes sizeOnDisk}} - {{episodeFileCount}} files + {{fileCount}} files {{#if_eq status compare="continuing"}} Continuing {{else}} diff --git a/src/UI/Series/Details/SeriesDetailsLayout.js b/src/UI/Series/Details/SeriesDetailsLayout.js index 1f8e2e0da..553c6a828 100644 --- a/src/UI/Series/Details/SeriesDetailsLayout.js +++ b/src/UI/Series/Details/SeriesDetailsLayout.js @@ -211,7 +211,7 @@ define( }, _showInfo: function () { - this.info.show(new InfoView({ model: this.model })); + this.info.show(new InfoView({ model: this.model, episodeFileCollection: this.episodeFileCollection })); }, _commandComplete: function (options) { diff --git a/src/UI/Series/EpisodeFileCollection.js b/src/UI/Series/EpisodeFileCollection.js index 42472d0ed..40322b133 100644 --- a/src/UI/Series/EpisodeFileCollection.js +++ b/src/UI/Series/EpisodeFileCollection.js @@ -12,6 +12,7 @@ define( initialize: function (options) { this.seriesId = options.seriesId; + this.models = []; }, fetch: function (options) {