From 4a4e440ec034e535b73b333b8934f27cac8914c7 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 3 Mar 2013 14:42:26 -0800 Subject: [PATCH] series structure cleanup. --- NzbDrone.Backbone/Controller.js | 6 +++--- NzbDrone.Backbone/NzbDrone.Backbone.csproj | 2 +- NzbDrone.Backbone/Series/Delete/DeleteSeriesView.js | 2 +- .../Series/Details/EpisodeCollection.js | 6 ------ NzbDrone.Backbone/Series/Details/EpisodeItemView.js | 2 +- NzbDrone.Backbone/Series/Details/SeasonCollection.js | 6 ------ .../Series/Details/SeriesDetailsView.js | 4 ++-- NzbDrone.Backbone/Series/Edit/EditSeriesView.js | 4 ++-- NzbDrone.Backbone/Series/EpisodeCollection.js | 6 ++++++ .../Series/{Details => }/EpisodeModel.js | 4 ++-- .../EmptySeriesIndexTemplate.html} | 0 .../SeriesIndexCollectionView.js} | 12 ++++++------ .../SeriesIndexTemplate.html} | 0 .../Series/{ => Index}/SeriesItemTemplate.html | 0 .../Series/{ => Index}/SeriesItemView.js | 6 +++--- NzbDrone.Backbone/Series/SeasonCollection.js | 6 ++++++ .../Series/{Details => }/SeasonModel.js | 2 +- NzbDrone.Backbone/app.js | 1 + 18 files changed, 35 insertions(+), 34 deletions(-) delete mode 100644 NzbDrone.Backbone/Series/Details/EpisodeCollection.js delete mode 100644 NzbDrone.Backbone/Series/Details/SeasonCollection.js create mode 100644 NzbDrone.Backbone/Series/EpisodeCollection.js rename NzbDrone.Backbone/Series/{Details => }/EpisodeModel.js (50%) rename NzbDrone.Backbone/Series/{EmptySeriesCollectionTemplate.html => Index/EmptySeriesIndexTemplate.html} (100%) rename NzbDrone.Backbone/Series/{SeriesCollectionView.js => Index/SeriesIndexCollectionView.js} (85%) rename NzbDrone.Backbone/Series/{SeriesCollectionTemplate.html => Index/SeriesIndexTemplate.html} (100%) rename NzbDrone.Backbone/Series/{ => Index}/SeriesItemTemplate.html (100%) rename NzbDrone.Backbone/Series/{ => Index}/SeriesItemView.js (82%) create mode 100644 NzbDrone.Backbone/Series/SeasonCollection.js rename NzbDrone.Backbone/Series/{Details => }/SeasonModel.js (85%) diff --git a/NzbDrone.Backbone/Controller.js b/NzbDrone.Backbone/Controller.js index 6f8b47678..164d0233a 100644 --- a/NzbDrone.Backbone/Controller.js +++ b/NzbDrone.Backbone/Controller.js @@ -1,8 +1,8 @@ define(['app', 'Shared/ModalRegion', 'AddSeries/AddSeriesLayout', - 'Series/SeriesCollectionView', 'Upcoming/UpcomingCollectionView', + 'Series/Index/SeriesIndexCollectionView', 'Upcoming/UpcomingCollectionView', 'Calendar/CalendarCollectionView', 'Shared/NotificationView', 'Shared/NotFoundView', 'MainMenuView', 'HeaderView', - 'Series/Details/SeriesDetailsView', 'Series/Details/EpisodeCollection'], + 'Series/Details/SeriesDetailsView', 'Series/EpisodeCollection'], function (app, modalRegion) { var controller = Backbone.Marionette.Controller.extend({ @@ -14,7 +14,7 @@ series: function (action, query) { this.setTitle('NzbDrone'); - NzbDrone.mainRegion.show(new NzbDrone.Series.SeriesCollectionView()); + NzbDrone.mainRegion.show(new NzbDrone.Series.Index.SeriesIndexCollectionView()); }, upcoming: function (action, query) { diff --git a/NzbDrone.Backbone/NzbDrone.Backbone.csproj b/NzbDrone.Backbone/NzbDrone.Backbone.csproj index c46f1fb9e..ee28ad25d 100644 --- a/NzbDrone.Backbone/NzbDrone.Backbone.csproj +++ b/NzbDrone.Backbone/NzbDrone.Backbone.csproj @@ -137,7 +137,7 @@ - + diff --git a/NzbDrone.Backbone/Series/Delete/DeleteSeriesView.js b/NzbDrone.Backbone/Series/Delete/DeleteSeriesView.js index abff3540b..e91b006dd 100644 --- a/NzbDrone.Backbone/Series/Delete/DeleteSeriesView.js +++ b/NzbDrone.Backbone/Series/Delete/DeleteSeriesView.js @@ -2,7 +2,7 @@ define(['app', 'Series/SeriesModel'], function () { - NzbDrone.Series.DeleteSeriesView = Backbone.Marionette.ItemView.extend({ + NzbDrone.Series.Delete.DeleteSeriesView = Backbone.Marionette.ItemView.extend({ template:'Series/Delete/DeleteSeriesTemplate', tagName:'div', className:"modal", diff --git a/NzbDrone.Backbone/Series/Details/EpisodeCollection.js b/NzbDrone.Backbone/Series/Details/EpisodeCollection.js deleted file mode 100644 index 786f205cd..000000000 --- a/NzbDrone.Backbone/Series/Details/EpisodeCollection.js +++ /dev/null @@ -1,6 +0,0 @@ -define(['app', 'Series/Details/EpisodeModel'], function () { - NzbDrone.Series.Details.EpisodeCollection = Backbone.Collection.extend({ - url: NzbDrone.Constants.ApiRoot + '/episode', - model: NzbDrone.Series.Details.EpisodeModel - }); -}); \ No newline at end of file diff --git a/NzbDrone.Backbone/Series/Details/EpisodeItemView.js b/NzbDrone.Backbone/Series/Details/EpisodeItemView.js index 3f8e70125..815d3a379 100644 --- a/NzbDrone.Backbone/Series/Details/EpisodeItemView.js +++ b/NzbDrone.Backbone/Series/Details/EpisodeItemView.js @@ -1,5 +1,5 @@ 'use strict'; -define(['app', 'Series/Details/SeasonModel'], function () { +define(['app', 'Series/SeasonModel'], function () { NzbDrone.Series.Details.EpisodeItemView = Backbone.Marionette.ItemView.extend({ template: 'Series/Details/EpisodeItemTemplate', diff --git a/NzbDrone.Backbone/Series/Details/SeasonCollection.js b/NzbDrone.Backbone/Series/Details/SeasonCollection.js deleted file mode 100644 index 848ccfa84..000000000 --- a/NzbDrone.Backbone/Series/Details/SeasonCollection.js +++ /dev/null @@ -1,6 +0,0 @@ -define(['app','Series/Details/SeasonModel'], function () { - NzbDrone.Series.Details.SeasonCollection = Backbone.Collection.extend({ - url: NzbDrone.Constants.ApiRoot + '/season', - model: NzbDrone.Series.Details.SeasonModel - }); -}); diff --git a/NzbDrone.Backbone/Series/Details/SeriesDetailsView.js b/NzbDrone.Backbone/Series/Details/SeriesDetailsView.js index da43e8029..037ae122d 100644 --- a/NzbDrone.Backbone/Series/Details/SeriesDetailsView.js +++ b/NzbDrone.Backbone/Series/Details/SeriesDetailsView.js @@ -1,4 +1,4 @@ -define(['app', 'Quality/QualityProfileCollection', 'Series/Details/SeasonCompositeView', 'Series/Details/SeasonCollection'], function () { +define(['app', 'Quality/QualityProfileCollection', 'Series/Details/SeasonCompositeView', 'Series/SeasonCollection'], function () { NzbDrone.Series.Details.SeriesDetailsView = Backbone.Marionette.CompositeView.extend({ itemView: NzbDrone.Series.Details.SeasonCompositeView, @@ -6,7 +6,7 @@ define(['app', 'Quality/QualityProfileCollection', 'Series/Details/SeasonComposi template: 'Series/Details/SeriesDetailsTemplate', initialize: function () { - this.collection = new NzbDrone.Series.Details.SeasonCollection(); + this.collection = new NzbDrone.Series.SeasonCollection(); this.collection.fetch({data: { seriesId: this.model.get('id') }}); } }); diff --git a/NzbDrone.Backbone/Series/Edit/EditSeriesView.js b/NzbDrone.Backbone/Series/Edit/EditSeriesView.js index b28ef6d40..8caa2a613 100644 --- a/NzbDrone.Backbone/Series/Edit/EditSeriesView.js +++ b/NzbDrone.Backbone/Series/Edit/EditSeriesView.js @@ -1,7 +1,7 @@ 'use strict'; define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection'], function () { - NzbDrone.Series.EditSeriesView = Backbone.Marionette.ItemView.extend({ + NzbDrone.Series.Edit.EditSeriesView = Backbone.Marionette.ItemView.extend({ template: 'Series/Edit/EditSeriesTemplate', tagName: 'div', className: "modal", @@ -36,7 +36,7 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/ }, removeSeries: function () { - var view = new NzbDrone.Series.DeleteSeriesView({ model: this.model }); + var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model }); NzbDrone.modalRegion.show(view); } }); diff --git a/NzbDrone.Backbone/Series/EpisodeCollection.js b/NzbDrone.Backbone/Series/EpisodeCollection.js new file mode 100644 index 000000000..8c5aaf731 --- /dev/null +++ b/NzbDrone.Backbone/Series/EpisodeCollection.js @@ -0,0 +1,6 @@ +define(['app', 'Series/EpisodeModel'], function () { + NzbDrone.Series.EpisodeCollection = Backbone.Collection.extend({ + url: NzbDrone.Constants.ApiRoot + '/episode', + model: NzbDrone.Series.EpisodeModel + }); +}); \ No newline at end of file diff --git a/NzbDrone.Backbone/Series/Details/EpisodeModel.js b/NzbDrone.Backbone/Series/EpisodeModel.js similarity index 50% rename from NzbDrone.Backbone/Series/Details/EpisodeModel.js rename to NzbDrone.Backbone/Series/EpisodeModel.js index e1635f3f8..c0cdf2681 100644 --- a/NzbDrone.Backbone/Series/Details/EpisodeModel.js +++ b/NzbDrone.Backbone/Series/EpisodeModel.js @@ -1,5 +1,5 @@ -define(['app'], function (app) { - NzbDrone.Series.Details.EpisodeModel = Backbone.Model.extend({ +define(['app'], function () { + NzbDrone.Series.EpisodeModel = Backbone.Model.extend({ mutators: { diff --git a/NzbDrone.Backbone/Series/EmptySeriesCollectionTemplate.html b/NzbDrone.Backbone/Series/Index/EmptySeriesIndexTemplate.html similarity index 100% rename from NzbDrone.Backbone/Series/EmptySeriesCollectionTemplate.html rename to NzbDrone.Backbone/Series/Index/EmptySeriesIndexTemplate.html diff --git a/NzbDrone.Backbone/Series/SeriesCollectionView.js b/NzbDrone.Backbone/Series/Index/SeriesIndexCollectionView.js similarity index 85% rename from NzbDrone.Backbone/Series/SeriesCollectionView.js rename to NzbDrone.Backbone/Series/Index/SeriesIndexCollectionView.js index 64964c81b..c1a1f8893 100644 --- a/NzbDrone.Backbone/Series/SeriesCollectionView.js +++ b/NzbDrone.Backbone/Series/Index/SeriesIndexCollectionView.js @@ -1,10 +1,10 @@ 'use strict'; -define(['app', 'Quality/QualityProfileCollection', 'Series/SeriesItemView'], function (app, qualityProfileCollection) { - NzbDrone.Series.SeriesCollectionView = Backbone.Marionette.CompositeView.extend({ - itemView: NzbDrone.Series.SeriesItemView, +define(['app', 'Quality/QualityProfileCollection', 'Series/Index/SeriesItemView'], function (app, qualityProfileCollection) { + NzbDrone.Series.Index.SeriesIndexCollectionView = Backbone.Marionette.CompositeView.extend({ + itemView: NzbDrone.Series.Index.SeriesItemView, itemViewContainer: 'tbody', - template: 'Series/SeriesCollectionTemplate', + template: 'Series/Index/SeriesIndexTemplate', qualityProfileCollection: qualityProfileCollection, //emptyView: NzbDrone.Series.EmptySeriesCollectionView, @@ -88,7 +88,7 @@ define(['app', 'Quality/QualityProfileCollection', 'Series/SeriesItemView'], fun }); }); -NzbDrone.Series.EmptySeriesCollectionView = Backbone.Marionette.CompositeView.extend({ - template: 'Series/EmptySeriesCollectionTemplate', +NzbDrone.Series.Index.EmptySeriesCollectionView = Backbone.Marionette.CompositeView.extend({ + template: 'Series/Index/EmptySeriesCollectionTemplate', tagName: 'tr' }); \ No newline at end of file diff --git a/NzbDrone.Backbone/Series/SeriesCollectionTemplate.html b/NzbDrone.Backbone/Series/Index/SeriesIndexTemplate.html similarity index 100% rename from NzbDrone.Backbone/Series/SeriesCollectionTemplate.html rename to NzbDrone.Backbone/Series/Index/SeriesIndexTemplate.html diff --git a/NzbDrone.Backbone/Series/SeriesItemTemplate.html b/NzbDrone.Backbone/Series/Index/SeriesItemTemplate.html similarity index 100% rename from NzbDrone.Backbone/Series/SeriesItemTemplate.html rename to NzbDrone.Backbone/Series/Index/SeriesItemTemplate.html diff --git a/NzbDrone.Backbone/Series/SeriesItemView.js b/NzbDrone.Backbone/Series/Index/SeriesItemView.js similarity index 82% rename from NzbDrone.Backbone/Series/SeriesItemView.js rename to NzbDrone.Backbone/Series/Index/SeriesItemView.js index 981194e0a..82a4a7be6 100644 --- a/NzbDrone.Backbone/Series/SeriesItemView.js +++ b/NzbDrone.Backbone/Series/Index/SeriesItemView.js @@ -9,8 +9,8 @@ define([ ], function () { - NzbDrone.Series.SeriesItemView = Backbone.Marionette.ItemView.extend({ - template: 'Series/SeriesItemTemplate', + NzbDrone.Series.Index.SeriesItemView = Backbone.Marionette.ItemView.extend({ + template: 'Series/Index/SeriesItemTemplate', tagName: 'tr', ui: { @@ -40,7 +40,7 @@ define([ }, removeSeries: function () { - var view = new NzbDrone.Series.DeleteSeriesView({ model: this.model }); + var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model }); NzbDrone.vent.trigger(NzbDrone.Events.OpenModalDialog, { view: view }); diff --git a/NzbDrone.Backbone/Series/SeasonCollection.js b/NzbDrone.Backbone/Series/SeasonCollection.js new file mode 100644 index 000000000..4704b6d5f --- /dev/null +++ b/NzbDrone.Backbone/Series/SeasonCollection.js @@ -0,0 +1,6 @@ +define(['app','Series/SeasonModel'], function () { + NzbDrone.Series.SeasonCollection = Backbone.Collection.extend({ + url: NzbDrone.Constants.ApiRoot + '/season', + model: NzbDrone.Series.SeasonModel + }); +}); diff --git a/NzbDrone.Backbone/Series/Details/SeasonModel.js b/NzbDrone.Backbone/Series/SeasonModel.js similarity index 85% rename from NzbDrone.Backbone/Series/Details/SeasonModel.js rename to NzbDrone.Backbone/Series/SeasonModel.js index cde835c86..1be6f8bf1 100644 --- a/NzbDrone.Backbone/Series/Details/SeasonModel.js +++ b/NzbDrone.Backbone/Series/SeasonModel.js @@ -1,5 +1,5 @@ define(['app'], function () { - NzbDrone.Series.Details.SeasonModel = Backbone.Model.extend({ + NzbDrone.Series.SeasonModel = Backbone.Model.extend({ mutators: { seasonTitle: function () { diff --git a/NzbDrone.Backbone/app.js b/NzbDrone.Backbone/app.js index e5e7b49d9..c2daa580e 100644 --- a/NzbDrone.Backbone/app.js +++ b/NzbDrone.Backbone/app.js @@ -30,6 +30,7 @@ define('app', function () { window.NzbDrone = new Backbone.Marionette.Application(); window.NzbDrone.Series = {}; + window.NzbDrone.Series.Index = {}; window.NzbDrone.Series.Edit = {}; window.NzbDrone.Series.Delete = {}; window.NzbDrone.Series.Details = {};