From 41c886b5dc3cbf81b7232771aff61441ce988565 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Mon, 20 May 2013 14:06:01 -0700 Subject: [PATCH] adding episode status to episode view. --- UI/Series/Details/EpisodeStatusCell.js | 8 +++++++ UI/Series/Details/SeasonLayout.js | 31 +++++++++++++------------- UI/Series/EpisodeModel.js | 5 ++++- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/UI/Series/Details/EpisodeStatusCell.js b/UI/Series/Details/EpisodeStatusCell.js index 00c5679f5..eefd537a2 100644 --- a/UI/Series/Details/EpisodeStatusCell.js +++ b/UI/Series/Details/EpisodeStatusCell.js @@ -17,6 +17,14 @@ define(['app', 'Episode/Layout'], function () { icon = 'icon-ok'; } + else { + if (this.model.get('hasAired')) { + icon = 'icon-warning-sign'; + } + else { + icon = 'icon-time'; + } + } this.$el.html(''.format(icon)); } diff --git a/UI/Series/Details/SeasonLayout.js b/UI/Series/Details/SeasonLayout.js index 28a749c23..62eca8536 100644 --- a/UI/Series/Details/SeasonLayout.js +++ b/UI/Series/Details/SeasonLayout.js @@ -1,5 +1,5 @@ 'use strict'; -define(['app', 'Series/Details/EpisodeDetailCell'], function () { +define(['app', 'Series/Details/EpisodeStatusCell'], function () { NzbDrone.Series.Details.SeasonLayout = Backbone.Marionette.Layout.extend({ template: 'Series/Details/SeasonLayoutTemplate', @@ -8,27 +8,28 @@ define(['app', 'Series/Details/EpisodeDetailCell'], function () { }, columns: [ + { - name : 'details', - label : 'Details', - cell : NzbDrone.Series.Details.EpisodeDetailCell - }, - { - name : 'episodeNumber', - label : '#', - cell : 'integer' + name : 'episodeNumber', + label: '#', + cell : 'integer' }, { - name : 'title', - label : 'Title', - cell : 'string' + name : 'title', + label: 'Title', + cell : 'string' }, { - name : 'airDate', - label : 'Air Date', - cell : 'date' + name : 'airDate', + label: 'Air Date', + cell : 'date' //formatter: new Backgrid.AirDateFormatter() + } , + { + name : 'status', + label: 'Status', + cell : NzbDrone.Series.Details.EpisodeStatusCell } ], diff --git a/UI/Series/EpisodeModel.js b/UI/Series/EpisodeModel.js index c354f08f3..c8f017b5c 100644 --- a/UI/Series/EpisodeModel.js +++ b/UI/Series/EpisodeModel.js @@ -43,12 +43,15 @@ define(['app'], function () { } return 'primary'; + }, + hasAired : function () { + return Date.create(this.get('airDate')).isBefore(Date.create()); } }, defaults: { seasonNumber: 0, - status: 0 + status : 0 } }); });