From e856a31a4d0653c2e014b9513725fb0a48f0f386 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 23 Jun 2013 19:31:02 -0700 Subject: [PATCH] Moar require --- NzbDrone.ncrunchsolution | 1 - UI/Cells/AirDateCell.js | 4 +- UI/Cells/EpisodeNumberCell.js | 2 +- UI/Cells/EpisodeStatusCell.js | 4 +- UI/Cells/EpisodeTitleCell.js | 2 +- UI/Cells/QualityCell.js | 4 +- UI/Cells/RelativeDateCell.js | 2 +- .../Index/Table => Cells}/SeriesStatusCell.js | 6 +-- UI/Cells/SeriesTitleCell.js | 4 +- UI/Cells/TemplatedCell.js | 4 +- UI/Cells/ToggleCell.js | 2 +- UI/Controller.js | 10 ++--- UI/History/Collection.js | 2 +- UI/History/EventTypeCell.js | 2 +- UI/History/HistoryLayout.js | 38 ++++++++++++------- UI/Missing/Collection.js | 2 +- UI/Missing/MissingLayout.js | 31 +++++++++------ UI/Series/Details/SeasonCollectionView.js | 8 +++- UI/Series/Details/SeasonLayout.js | 12 +++--- UI/Series/Index/SeriesIndexLayout.js | 6 +-- 20 files changed, 83 insertions(+), 63 deletions(-) rename UI/{Series/Index/Table => Cells}/SeriesStatusCell.js (83%) diff --git a/NzbDrone.ncrunchsolution b/NzbDrone.ncrunchsolution index 444b34b1d..6cb47a29a 100644 --- a/NzbDrone.ncrunchsolution +++ b/NzbDrone.ncrunchsolution @@ -2,7 +2,6 @@ 1 False true - true UseDynamicAnalysis Disabled Disabled diff --git a/UI/Cells/AirDateCell.js b/UI/Cells/AirDateCell.js index 08d31eff9..47a10b55b 100644 --- a/UI/Cells/AirDateCell.js +++ b/UI/Cells/AirDateCell.js @@ -1,6 +1,6 @@ 'use strict'; -define(['app', 'Shared/FormatHelpers','backgrid'], function () { - NzbDrone.Cells.AirDateCell = Backgrid.Cell.extend({ +define(['app', 'Shared/FormatHelpers', 'Cells/NzbDroneCell'], function () { + return NzbDrone.Cells.NzbDroneCell.extend({ className: 'air-date-cell', render: function () { diff --git a/UI/Cells/EpisodeNumberCell.js b/UI/Cells/EpisodeNumberCell.js index 28670c712..093d6ca15 100644 --- a/UI/Cells/EpisodeNumberCell.js +++ b/UI/Cells/EpisodeNumberCell.js @@ -1,7 +1,7 @@ 'use strict'; define(['app', 'Cells/NzbDroneCell'], function () { - NzbDrone.Cells.EpisodeNumberCell = NzbDrone.Cells.NzbDroneCell.extend({ + return NzbDrone.Cells.NzbDroneCell.extend({ className: 'episode-number-cell', diff --git a/UI/Cells/EpisodeStatusCell.js b/UI/Cells/EpisodeStatusCell.js index 34a7b3533..4eee59c80 100644 --- a/UI/Cells/EpisodeStatusCell.js +++ b/UI/Cells/EpisodeStatusCell.js @@ -1,7 +1,7 @@ 'use strict'; -define(['app','backgrid' ], function () { - NzbDrone.Cells.EpisodeStatusCell = Backgrid.Cell.extend({ +define(['app','cells/nzbdronecell' ], function () { + return NzbDrone.Cells.NzbDroneCell.extend({ className: 'episode-status-cell', diff --git a/UI/Cells/EpisodeTitleCell.js b/UI/Cells/EpisodeTitleCell.js index b52d8ea59..98681b0ac 100644 --- a/UI/Cells/EpisodeTitleCell.js +++ b/UI/Cells/EpisodeTitleCell.js @@ -1,7 +1,7 @@ 'use strict'; define(['app', 'Cells/NzbDroneCell'], function () { - NzbDrone.Cells.EpisodeTitleCell = NzbDrone.Cells.NzbDroneCell.extend({ + return NzbDrone.Cells.NzbDroneCell.extend({ className: 'episode-title-cell', diff --git a/UI/Cells/QualityCell.js b/UI/Cells/QualityCell.js index 409bf2e3f..452d8fceb 100644 --- a/UI/Cells/QualityCell.js +++ b/UI/Cells/QualityCell.js @@ -1,6 +1,6 @@ 'use strict'; -define(['app', 'Cells/TemplatedCell'], function () { - NzbDrone.Cells.QualityCell = NzbDrone.Cells.TemplatedCell.extend({ +define(['app', 'Cells/TemplatedCell'], function (App, TemplatedCell) { + return TemplatedCell.extend({ className: 'quality-cell', template : 'Cells/QualityTemplate' diff --git a/UI/Cells/RelativeDateCell.js b/UI/Cells/RelativeDateCell.js index ffab2a98a..826516d41 100644 --- a/UI/Cells/RelativeDateCell.js +++ b/UI/Cells/RelativeDateCell.js @@ -1,6 +1,6 @@ 'use strict'; define(['app','Cells/NzbDroneCell'], function () { - NzbDrone.Cells.RelativeDateCell = NzbDrone.Cells.NzbDroneCell.extend({ + return NzbDrone.Cells.NzbDroneCell.extend({ className : 'relative-date-cell', diff --git a/UI/Series/Index/Table/SeriesStatusCell.js b/UI/Cells/SeriesStatusCell.js similarity index 83% rename from UI/Series/Index/Table/SeriesStatusCell.js rename to UI/Cells/SeriesStatusCell.js index d0e110674..1bbd0a062 100644 --- a/UI/Series/Index/Table/SeriesStatusCell.js +++ b/UI/Cells/SeriesStatusCell.js @@ -1,6 +1,6 @@ 'use strict'; -define(['app','backgrid'], function () { - Backgrid.SeriesStatusCell = Backgrid.Cell.extend({ +define(['app','cells/nzbdronecell'], function () { + return NzbDrone.Cells.NzbDroneCell.extend({ className: 'series-status-cell', render: function () { @@ -22,6 +22,4 @@ define(['app','backgrid'], function () { return this; } }); - - return Backgrid.SeriesStatusCell; }); diff --git a/UI/Cells/SeriesTitleCell.js b/UI/Cells/SeriesTitleCell.js index ee6630273..7fae88d17 100644 --- a/UI/Cells/SeriesTitleCell.js +++ b/UI/Cells/SeriesTitleCell.js @@ -1,6 +1,6 @@ 'use strict'; -define(['app', 'Cells/TemplatedCell'], function () { - NzbDrone.Cells.SeriesTitleCell = NzbDrone.Cells.TemplatedCell.extend({ +define(['app', 'Cells/TemplatedCell'], function (App, TemplatedCell) { + return TemplatedCell.extend({ className: 'series-title', template : 'Cells/SeriesTitleTemplate' diff --git a/UI/Cells/TemplatedCell.js b/UI/Cells/TemplatedCell.js index 37321830d..fbf0f2528 100644 --- a/UI/Cells/TemplatedCell.js +++ b/UI/Cells/TemplatedCell.js @@ -1,9 +1,7 @@ 'use strict'; define(['app','Cells/NzbDroneCell'], function () { - NzbDrone.Cells.TemplatedCell = NzbDrone.Cells.NzbDroneCell.extend({ - - + return NzbDrone.Cells.NzbDroneCell.extend({ render: function () { var templateName = this.column.get('template') || this.template; diff --git a/UI/Cells/ToggleCell.js b/UI/Cells/ToggleCell.js index aeaa51b08..612955e84 100644 --- a/UI/Cells/ToggleCell.js +++ b/UI/Cells/ToggleCell.js @@ -1,7 +1,7 @@ 'use strict'; define(['app', 'Episode/Layout'], function () { - NzbDrone.Cells.ToggleCell = Backgrid.Cell.extend({ + return Backgrid.Cell.extend({ className: 'toggle-cell clickable', diff --git a/UI/Controller.js b/UI/Controller.js index 6a22e2930..9227a35c7 100644 --- a/UI/Controller.js +++ b/UI/Controller.js @@ -4,6 +4,8 @@ define( 'app', 'Settings/SettingsLayout', 'AddSeries/AddSeriesLayout', + 'Missing/MissingLayout', + 'History/HistoryLayout', 'Form/FormBuilder', 'Series/Index/SeriesIndexLayout', 'Calendar/CalendarLayout', @@ -14,12 +16,10 @@ define( 'Series/EpisodeCollection', 'Logs/Layout', 'Release/Layout', - 'Missing/MissingLayout', - 'History/HistoryLayout', 'Shared/FormatHelpers', 'Shared/TemplateHelpers', 'Shared/Footer/View' - ], function (App, SettingsLayout, AddSeriesLayout) { + ], function (App, SettingsLayout, AddSeriesLayout, MissingLayout, HistoryLayout) { var controller = Backbone.Marionette.Controller.extend({ series : function () { @@ -58,13 +58,13 @@ define( missing: function () { this._setTitle('Missing'); - App.mainRegion.show(new NzbDrone.Missing.MissingLayout()); + App.mainRegion.show(new MissingLayout()); }, history: function () { this._setTitle('History'); - App.mainRegion.show(new NzbDrone.History.HistoryLayout()); + App.mainRegion.show(new HistoryLayout()); }, rss: function () { diff --git a/UI/History/Collection.js b/UI/History/Collection.js index 7b8f64a75..edbd0ec33 100644 --- a/UI/History/Collection.js +++ b/UI/History/Collection.js @@ -1,6 +1,6 @@ 'use strict'; define(['app', 'History/Model', 'backbone.pageable'], function (App, HistoryModel, PageableCollection) { - NzbDrone.History.Collection = PageableCollection.extend({ + return PageableCollection.extend({ url : NzbDrone.Constants.ApiRoot + '/history', model : NzbDrone.History.Model, diff --git a/UI/History/EventTypeCell.js b/UI/History/EventTypeCell.js index 173e95a49..e5acc4112 100644 --- a/UI/History/EventTypeCell.js +++ b/UI/History/EventTypeCell.js @@ -1,7 +1,7 @@ 'use strict'; define(['app', 'Cells/NzbDroneCell' ], function () { - NzbDrone.History.EventTypeCell = NzbDrone.Cells.NzbDroneCell.extend({ + return NzbDrone.Cells.NzbDroneCell.extend({ className: 'history-event-type-cell', diff --git a/UI/History/HistoryLayout.js b/UI/History/HistoryLayout.js index 4c009dc15..c7b05fe0e 100644 --- a/UI/History/HistoryLayout.js +++ b/UI/History/HistoryLayout.js @@ -14,8 +14,20 @@ define([ 'Shared/Grid/HeaderCell', 'Shared/LoadingView' ], - function () { - NzbDrone.History.HistoryLayout = Backbone.Marionette.Layout.extend({ + function (App, + HistoryCollection, + EventTypeCell, + RelativeDateCell, + TemplatedCell, + SeriesTitleCell, + EpisodeNumberCell, + EpisodeTitleCell, + QualityCell, + ToolbarLayout, + Pager, + HeaderCell, + LoadingView) { + return Backbone.Marionette.Layout.extend({ template: 'History/HistoryLayoutTemplate', regions: { @@ -28,34 +40,34 @@ define([ { name: 'eventType', label:'', - cell : NzbDrone.History.EventTypeCell + cell : EventTypeCell }, { name : 'series', label : 'Series', - cell : NzbDrone.Cells.SeriesTitleCell + cell : SeriesTitleCell }, { name : 'episode', label : 'Episode', sortable: false, - cell : NzbDrone.Cells.EpisodeNumberCell + cell : EpisodeNumberCell }, { name : 'episode', label : 'Episode Title', sortable: false, - cell : NzbDrone.Cells.EpisodeTitleCell + cell : EpisodeTitleCell }, { - name : 'quality', - label: 'Quality', - cell : NzbDrone.Cells.QualityCell + name : 'quality', + label : 'Quality', + cell : QualityCell }, { name : 'date', label: 'Date', - cell : NzbDrone.Cells.RelativeDateCell + cell : RelativeDateCell } ], @@ -69,7 +81,7 @@ define([ className : 'table table-hover' })); - this.pager.show(new NzbDrone.Shared.Grid.Pager({ + this.pager.show(new Pager({ columns : this.columns, collection: this.historyCollection })); @@ -78,9 +90,9 @@ define([ onShow: function () { var self = this; - this.history.show(new NzbDrone.Shared.LoadingView()); + this.history.show(new LoadingView()); - this.historyCollection = new NzbDrone.History.Collection(); + this.historyCollection = new HistoryCollection(); this.historyCollection.fetch() .done(function () { self._showTable(); diff --git a/UI/Missing/Collection.js b/UI/Missing/Collection.js index dcd11ab10..8d6c7297c 100644 --- a/UI/Missing/Collection.js +++ b/UI/Missing/Collection.js @@ -1,6 +1,6 @@ 'use strict'; define(['app', 'Series/EpisodeModel', 'backbone.pageable'], function (app, EpisodeModel, PagableCollection) { - NzbDrone.Missing.Collection = PagableCollection.extend({ + return PagableCollection.extend({ url : NzbDrone.Constants.ApiRoot + '/missing', model: NzbDrone.Series.EpisodeModel, diff --git a/UI/Missing/MissingLayout.js b/UI/Missing/MissingLayout.js index f2bbcf1cd..8dda7ee45 100644 --- a/UI/Missing/MissingLayout.js +++ b/UI/Missing/MissingLayout.js @@ -10,11 +10,20 @@ define( 'Cells/SeriesTitleCell', 'Cells/EpisodeNumberCell', 'Cells/EpisodeTitleCell', - 'Cells/AirDateCell', 'Shared/Grid/Pager', 'Shared/LoadingView' - ], function (App, MissingRow) { - NzbDrone.Missing.MissingLayout = Backbone.Marionette.Layout.extend({ + ], function (App, + MissingRow, + MissingCollection, + AirDateCell, + SeriesStatusCell, + ToolbarLayout, + SeriesTitleCell, + EpisodeNumberCell, + EpisodeTitleCell, + Pager, + LoadingView) { + return Backbone.Marionette.Layout.extend({ template: 'Missing/MissingLayoutTemplate', regions: { @@ -29,24 +38,24 @@ define( name : 'series', label : 'Series Title', sortable: false, - cell : NzbDrone.Cells.SeriesTitleCell + cell : SeriesTitleCell }, { name : 'this', label : 'Episode', sortable: false, - cell : NzbDrone.Cells.EpisodeNumberCell + cell : EpisodeNumberCell }, { name : 'this', label : 'Episode Title', sortable: false, - cell : NzbDrone.Cells.EpisodeTitleCell + cell : EpisodeTitleCell }, { - name : 'airDate', - label: 'Air Date', - cell : NzbDrone.Cells.AirDateCell + name : 'airDate', + label : 'Air Date', + cell : AirDateCell } ], @@ -67,9 +76,9 @@ define( onShow: function () { var self = this; - this.missing.show(new NzbDrone.Shared.LoadingView()); + this.missing.show(new LoadingView()); - this.missingCollection = new NzbDrone.Missing.Collection(); + this.missingCollection = new MissingCollection(); this.missingCollection.fetch().done(function () { self._showTable(); }); diff --git a/UI/Series/Details/SeasonCollectionView.js b/UI/Series/Details/SeasonCollectionView.js index c76138748..3684684e4 100644 --- a/UI/Series/Details/SeasonCollectionView.js +++ b/UI/Series/Details/SeasonCollectionView.js @@ -1,8 +1,12 @@ 'use strict'; -define(['app', 'Series/Details/SeasonLayout', 'Series/SeasonCollection', 'Series/EpisodeCollection'], function () { +define(['app', + 'Series/Details/SeasonLayout', + 'Series/SeasonCollection', + 'Series/EpisodeCollection'], + function (App, SeasonLayout, SeasonCollection, EpisodeCollection) { NzbDrone.Series.Details.SeasonCollectionView = Backbone.Marionette.CollectionView.extend({ - itemView : NzbDrone.Series.Details.SeasonLayout, + itemView : SeasonLayout, initialize: function (options) { diff --git a/UI/Series/Details/SeasonLayout.js b/UI/Series/Details/SeasonLayout.js index 343242d09..ea1da3b97 100644 --- a/UI/Series/Details/SeasonLayout.js +++ b/UI/Series/Details/SeasonLayout.js @@ -5,8 +5,8 @@ define([ 'Cells/EpisodeTitleCell', 'Cells/AirDateCell', 'Cells/ToggleCell'], - function () { - NzbDrone.Series.Details.SeasonLayout = Backbone.Marionette.Layout.extend({ + function (App, EpisodeStatusCell, EpisodeTitleCell, AirDateCell, ToggleCell) { + return Backbone.Marionette.Layout.extend({ template: 'Series/Details/SeasonLayoutTemplate', regions: { @@ -18,7 +18,7 @@ define([ { name : 'ignored', label : '', - cell : NzbDrone.Cells.ToggleCell, + cell : ToggleCell, trueClass : 'icon-bookmark-empty', falseClass: 'icon-bookmark' }, @@ -33,17 +33,17 @@ define([ { name : 'this', label: 'Title', - cell : NzbDrone.Cells.EpisodeTitleCell + cell : EpisodeTitleCell }, { name : 'airDate', label: 'Air Date', - cell : NzbDrone.Cells.AirDateCell + cell : AirDateCell } , { name : 'status', label: 'Status', - cell : NzbDrone.Cells.EpisodeStatusCell + cell : EpisodeStatusCell } ], diff --git a/UI/Series/Index/SeriesIndexLayout.js b/UI/Series/Index/SeriesIndexLayout.js index a885c36f4..b5e66f04a 100644 --- a/UI/Series/Index/SeriesIndexLayout.js +++ b/UI/Series/Index/SeriesIndexLayout.js @@ -7,8 +7,8 @@ define([ 'Series/SeriesCollection', 'Cells/AirDateCell', 'Cells/SeriesTitleCell', + 'Cells/SeriesStatusCell', 'Cells/TemplatedCell', - 'Series/Index/Table/SeriesStatusCell', 'Shared/Toolbar/ToolbarLayout', 'Config', 'Shared/LoadingView' @@ -21,8 +21,8 @@ define([ SeriesCollection, AirDateCell, SeriesTitleCell, - TemplatedCell, SeriesStatusCell, + TemplatedCell, ToolbarLayout, Config, LoadingView) @@ -39,7 +39,7 @@ define([ { name : 'status', label: '', - cell : 'seriesStatus' + cell : SeriesStatusCell }, { name : 'this',