From 475c86dcaba2d74878db4bb9df9ebefde7853a28 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 23 Apr 2013 17:30:25 -0700 Subject: [PATCH] Series Table --- UI/Mixins/backbone.Backgrid.mixin.js | 36 ------------------- UI/Series/Index/EmptySeriesIndexView.js | 8 ----- ...sIndexTemplate.html => EmptyTemplate.html} | 0 UI/Series/Index/EmptyView.js | 8 +++++ UI/Series/Index/List/ItemTemplate.html | 2 +- UI/Series/Index/SeriesIndexLayout.js | 9 ++++- UI/Series/Index/Table/AirDateCell.js | 12 +++++++ UI/Series/Index/Table/SeriesStatusCell.js | 22 ++++++++++++ 8 files changed, 51 insertions(+), 46 deletions(-) delete mode 100644 UI/Series/Index/EmptySeriesIndexView.js rename UI/Series/Index/{EmptySeriesIndexTemplate.html => EmptyTemplate.html} (100%) create mode 100644 UI/Series/Index/EmptyView.js create mode 100644 UI/Series/Index/Table/AirDateCell.js create mode 100644 UI/Series/Index/Table/SeriesStatusCell.js diff --git a/UI/Mixins/backbone.Backgrid.mixin.js b/UI/Mixins/backbone.Backgrid.mixin.js index 31ef8ae89..edc41d2fe 100644 --- a/UI/Mixins/backbone.Backgrid.mixin.js +++ b/UI/Mixins/backbone.Backgrid.mixin.js @@ -1,39 +1,3 @@ -Backgrid.SeriesStatusCell = Backgrid.Cell.extend({ - className: "series-status-cell", - - render: function () { - this.$el.empty(); - var monitored = this.model.get('monitored'); - var status = this.model.get('status'); - - if (!monitored) { - this.$el.html(''); - } - else if (status === 0) { - this.$el.html(''); - } - - else { - this.$el.html(''); - } - - return this; - } -}); - -Backgrid.AirDateCell = Backgrid.Cell.extend({ - className: "air-date-cell", - - render: function () { - this.$el.empty(); - var airDate = this.model.get(this.column.get("name")); - - this.$el.html(bestDateString(airDate)); - - return this; - } -}); - Backgrid.TemplateBackedCell = Backgrid.Cell.extend({ className: '', template: 'Series/Index/Table/ControlsColumnTemplate', diff --git a/UI/Series/Index/EmptySeriesIndexView.js b/UI/Series/Index/EmptySeriesIndexView.js deleted file mode 100644 index 97ec6cd82..000000000 --- a/UI/Series/Index/EmptySeriesIndexView.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -define(['app'], function (app) { - - NzbDrone.Series.Index.EmptySeriesCollectionView = Backbone.Marionette.CompositeView.extend({ - template: 'Series/Index/EmptySeriesIndexTemplate' - }); -}); \ No newline at end of file diff --git a/UI/Series/Index/EmptySeriesIndexTemplate.html b/UI/Series/Index/EmptyTemplate.html similarity index 100% rename from UI/Series/Index/EmptySeriesIndexTemplate.html rename to UI/Series/Index/EmptyTemplate.html diff --git a/UI/Series/Index/EmptyView.js b/UI/Series/Index/EmptyView.js new file mode 100644 index 000000000..64376a54b --- /dev/null +++ b/UI/Series/Index/EmptyView.js @@ -0,0 +1,8 @@ +'use strict'; + +define(['app'], function (app) { + + NzbDrone.Series.Index.EmptyView = Backbone.Marionette.CompositeView.extend({ + template: 'Series/Index/EmptyTemplate' + }); +}); \ No newline at end of file diff --git a/UI/Series/Index/List/ItemTemplate.html b/UI/Series/Index/List/ItemTemplate.html index 8285ee20e..605f0153f 100644 --- a/UI/Series/Index/List/ItemTemplate.html +++ b/UI/Series/Index/List/ItemTemplate.html @@ -1,7 +1,7 @@ 
diff --git a/UI/Series/Index/SeriesIndexLayout.js b/UI/Series/Index/SeriesIndexLayout.js index 30e3ba5d6..4567c480f 100644 --- a/UI/Series/Index/SeriesIndexLayout.js +++ b/UI/Series/Index/SeriesIndexLayout.js @@ -2,7 +2,10 @@ define([ 'app', 'Series/Index/List/CollectionView', - 'Config' + 'Series/Index/EmptyView', + 'Config', + 'Series/Index/Table/AirDateCell', + 'Series/Index/Table/SeriesStatusCell' ], function (app) { NzbDrone.Series.Index.SeriesIndexLayout = Backbone.Marionette.Layout.extend({ @@ -97,6 +100,10 @@ define([ this.series.show(new NzbDrone.Series.Index.List.CollectionView({ collection: this.seriesCollection })); }, + showEmpty: function () { + this.series.show(new NzbDrone.Series.Index.EmptyView()); + }, + initialize: function () { this.viewStyle = NzbDrone.Config.SeriesViewStyle(); this.seriesCollection = new NzbDrone.Series.SeriesCollection(); diff --git a/UI/Series/Index/Table/AirDateCell.js b/UI/Series/Index/Table/AirDateCell.js new file mode 100644 index 000000000..0b94cd5d8 --- /dev/null +++ b/UI/Series/Index/Table/AirDateCell.js @@ -0,0 +1,12 @@ +Backgrid.AirDateCell = Backgrid.Cell.extend({ + className: "air-date-cell", + + render: function () { + this.$el.empty(); + var airDate = this.model.get(this.column.get("name")); + + this.$el.html(bestDateString(airDate)); + + return this; + } +}); \ No newline at end of file diff --git a/UI/Series/Index/Table/SeriesStatusCell.js b/UI/Series/Index/Table/SeriesStatusCell.js new file mode 100644 index 000000000..4b5ebeaa7 --- /dev/null +++ b/UI/Series/Index/Table/SeriesStatusCell.js @@ -0,0 +1,22 @@ +Backgrid.SeriesStatusCell = Backgrid.Cell.extend({ + className: "series-status-cell", + + render: function () { + this.$el.empty(); + var monitored = this.model.get('monitored'); + var status = this.model.get('status'); + + if (!monitored) { + this.$el.html(''); + } + else if (status === 0) { + this.$el.html(''); + } + + else { + this.$el.html(''); + } + + return this; + } +}); \ No newline at end of file