diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 311633649..4a1a057fb 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -183,18 +183,22 @@ - - - - - - - - + + + + + + + + + + + + - - - + + + diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js b/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js index c6ceb2d56..8e92a4347 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js @@ -1,9 +1,9 @@ /// -/// -/// +/// +/// /// /// -/// +/// NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({ template: 'AddSeries/addSeriesLayoutTemplate', @@ -74,12 +74,12 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({ this.qualityProfileCollection.fetch(); this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView({ rootFolders: this.rootFolderCollection, qualityProfiles: this.qualityProfileCollection })); - this.importExisting.show(new NzbDrone.AddSeries.ExistingFolderListView({ collection: this.rootFolderCollection })); + this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView({ collection: this.rootFolderCollection })); this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection })); - NzbDrone.vent.listenTo(this.rootFolderCollection, 'add', this.evaluateActions, this); - NzbDrone.vent.listenTo(this.rootFolderCollection, 'remove', this.evaluateActions, this); - NzbDrone.vent.listenTo(this.rootFolderCollection, 'reset', this.evaluateActions, this); + this.listenTo(this.rootFolderCollection, 'add', this.evaluateActions, this); + this.listenTo(this.rootFolderCollection, 'remove', this.evaluateActions, this); + this.listenTo(this.rootFolderCollection, 'reset', this.evaluateActions, this); }, onShow: function () { diff --git a/NzbDrone.Web/_backboneApp/AddSeries/Existing/FolderMatchResultViewTemplatate.html b/NzbDrone.Web/_backboneApp/AddSeries/Existing/FolderMatchResultViewTemplatate.html new file mode 100644 index 000000000..4d068190e --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/Existing/FolderMatchResultViewTemplatate.html @@ -0,0 +1,5 @@ +
+ +
{{seriesName}} {{seriesYear}}
+
+
diff --git a/NzbDrone.Web/_backboneApp/AddSeries/Existing/ImportSeriesView.js b/NzbDrone.Web/_backboneApp/AddSeries/Existing/ImportSeriesView.js new file mode 100644 index 000000000..b00846f47 --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/Existing/ImportSeriesView.js @@ -0,0 +1,65 @@ +'use strict'; +/// +/// +/// +/// + + +NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({ + template: "AddSeries/Existing/FolderMatchResultViewTemplatate", + + +}); + +NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({ + + template: "AddSeries/Existing/UnmappedFolderCompositeViewTemplatate", + itemViewContainer: ".x-folder-name-match-results", + itemView: NzbDrone.AddSeries.Existing.FolderMatchResultView, + + events: { + 'click .x-search': 'search' + }, + + initialize: function () { + this.collection = new NzbDrone.AddSeries.SearchResultCollection(); + }, + + search: function () { + + this.collection.fetch({ + data: $.param({ term: 'simpsons' }) + }); + } + +}); + +NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({ + + template: "AddSeries/Existing/RootFolderCompositeViewTemplate", + itemViewContainer: ".x-existing-folder-container", + itemView: NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView, + + initialize: function () { + + if (!this.model) { + throw "model is required."; + } + + this.collection = new NzbDrone.AddSeries.Existing.UnmappedFolderCollection(); + this.collection.importArray(this.model.get('unmappedFolders')); + + }, + +}); + +NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({ + + itemView: NzbDrone.AddSeries.Existing.RootFolderCompositeView, + + initialize: function () { + if (!this.collection) { + throw "root folder collection is required."; + } + } +}); diff --git a/NzbDrone.Web/_backboneApp/AddSeries/Existing/RootFolderCompositeViewTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/Existing/RootFolderCompositeViewTemplate.html new file mode 100644 index 000000000..a2cf5b87c --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/Existing/RootFolderCompositeViewTemplate.html @@ -0,0 +1,20 @@ +
+

{{path}}

+ +
+ +
+ + +
diff --git a/NzbDrone.Web/_backboneApp/AddSeries/ImportExistingSeries/ImportSeriesTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/Existing/RootFoldersCompositeView.html similarity index 100% rename from NzbDrone.Web/_backboneApp/AddSeries/ImportExistingSeries/ImportSeriesTemplate.html rename to NzbDrone.Web/_backboneApp/AddSeries/Existing/RootFoldersCompositeView.html diff --git a/NzbDrone.Web/_backboneApp/AddSeries/Existing/UnmappedFolderCompositeViewTemplatate.html b/NzbDrone.Web/_backboneApp/AddSeries/Existing/UnmappedFolderCompositeViewTemplatate.html new file mode 100644 index 000000000..7e45741d7 --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/Existing/UnmappedFolderCompositeViewTemplatate.html @@ -0,0 +1,7 @@ +
+ {{folder}} + +
+ +
+
diff --git a/NzbDrone.Web/_backboneApp/AddSeries/Existing/UnmappedFolderModel.js b/NzbDrone.Web/_backboneApp/AddSeries/Existing/UnmappedFolderModel.js new file mode 100644 index 000000000..8e49d8532 --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/Existing/UnmappedFolderModel.js @@ -0,0 +1,25 @@ +'use strict'; +/// +NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({ + + +}); + +NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.extend({ + model: NzbDrone.AddSeries.Existing.UnmappedFolderModel, + + + importArray: function (unmappedFolderArray) { + + if (!unmappedFolderArray) { + throw "folder array is required"; + } + + _.each(unmappedFolderArray, function (folder) { + this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({ folder: folder })); + }, this); + } +}); + + + diff --git a/NzbDrone.Web/_backboneApp/AddSeries/ImportExistingSeries/ImportSeriesView.js b/NzbDrone.Web/_backboneApp/AddSeries/ImportExistingSeries/ImportSeriesView.js deleted file mode 100644 index 963ec3ebc..000000000 --- a/NzbDrone.Web/_backboneApp/AddSeries/ImportExistingSeries/ImportSeriesView.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; -/*global NzbDrone, Backbone*/ - -/// -/// -/// -NzbDrone.AddSeries.ExistingFolderItemView = Backbone.Marionette.ItemView.extend({ - - template: "AddSeries/ImportExistingSeries/ImportSeriesTemplate", - - events: { - //'click .x-add': 'add' - } -}); - -NzbDrone.AddSeries.ExistingFolderListView = Backbone.Marionette.CollectionView.extend({ - - itemView: NzbDrone.AddSeries.ExistingFolderItemView, - - initialize: function () { - - if (this.collection === undefined) { - throw "root folder collection is required."; - } - - this.listenTo(this.collection, 'reset', this.render, this); - } -}); diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/New/AddNewSeriesTemplate.html similarity index 100% rename from NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesTemplate.html rename to NzbDrone.Web/_backboneApp/AddSeries/New/AddNewSeriesTemplate.html diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js b/NzbDrone.Web/_backboneApp/AddSeries/New/AddNewSeriesView.js similarity index 97% rename from NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js rename to NzbDrone.Web/_backboneApp/AddSeries/New/AddNewSeriesView.js index d15551c91..769fb9492 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/New/AddNewSeriesView.js @@ -3,7 +3,7 @@ /// NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({ - template: 'AddSeries/AddNewSeries/AddNewSeriesTemplate', + template: 'AddSeries/New/AddNewSeriesTemplate', route: 'Series/add/new', ui: { @@ -16,6 +16,8 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({ collection: new NzbDrone.AddSeries.SearchResultCollection(), + + initialize: function (options) { if (options.rootFolders === undefined) { throw 'rootFolder arg. is required.'; @@ -25,6 +27,7 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({ throw 'qualityProfiles arg. is required.'; } + this.rootFoldersCollection = options.rootFolders; this.qualityProfilesCollection = options.qualityProfiles; }, diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/New/SearchResultTemplate.html similarity index 100% rename from NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultTemplate.html rename to NzbDrone.Web/_backboneApp/AddSeries/New/SearchResultTemplate.html diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultView.js b/NzbDrone.Web/_backboneApp/AddSeries/New/SearchResultView.js similarity index 96% rename from NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultView.js rename to NzbDrone.Web/_backboneApp/AddSeries/New/SearchResultView.js index 26cfaa959..3e8d074e2 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultView.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/New/SearchResultView.js @@ -7,7 +7,7 @@ NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({ - template: "AddSeries/AddNewSeries/SearchResultTemplate", + template: "AddSeries/New/SearchResultTemplate", className: 'search-item', ui: { diff --git a/NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirCollection.js b/NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirCollection.js similarity index 100% rename from NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirCollection.js rename to NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirCollection.js diff --git a/NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirItemTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirItemTemplate.html similarity index 100% rename from NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirItemTemplate.html rename to NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirItemTemplate.html diff --git a/NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirModel.js b/NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirModel.js similarity index 100% rename from NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirModel.js rename to NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirModel.js diff --git a/NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirTemplate.html similarity index 100% rename from NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirTemplate.html rename to NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirTemplate.html diff --git a/NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirView.js b/NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirView.js similarity index 94% rename from NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirView.js rename to NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirView.js index 348e945b5..b8c65410f 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/RootDir/RootDirView.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/RootFolders/RootDirView.js @@ -5,7 +5,7 @@ NzbDrone.AddSeries.RootDirItemView = Backbone.Marionette.ItemView.extend({ - template: 'AddSeries/RootDir/RootDirItemTemplate', + template: 'AddSeries/RootFolders/RootDirItemTemplate', tagName: 'tr', events: { @@ -31,7 +31,7 @@ NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({ }); NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({ - template: 'AddSeries/RootDir/RootDirTemplate', + template: 'AddSeries/RootFolders/RootDirTemplate', route: 'series/add/rootdir', ui: { diff --git a/NzbDrone.Web/_backboneApp/AddSeries/SearchResultModel.js b/NzbDrone.Web/_backboneApp/AddSeries/SearchResultModel.js index 139e879d6..215cd0ba1 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/SearchResultModel.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/SearchResultModel.js @@ -1,5 +1,5 @@ /// -/// +/// /// NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({ mutators: { diff --git a/NzbDrone.Web/_backboneApp/Shared/NotificationModel.js b/NzbDrone.Web/_backboneApp/Shared/NotificationModel.js index 0c875a21f..14b94de11 100644 --- a/NzbDrone.Web/_backboneApp/Shared/NotificationModel.js +++ b/NzbDrone.Web/_backboneApp/Shared/NotificationModel.js @@ -1,12 +1,4 @@ /// - -NzbDrone.Shared.NotificationCollection = Backbone.Collection.extend({ - - model: NzbDrone.Shared.NotificationModel, - -}); - - NzbDrone.Shared.NotificationModel = Backbone.Model.extend({ mutators: { @@ -40,3 +32,10 @@ NzbDrone.Shared.NotificationModel = Backbone.Model.extend({ "message": "", } }); + + +NzbDrone.Shared.NotificationCollection = Backbone.Collection.extend({ + + model: NzbDrone.Shared.NotificationModel, + +}); diff --git a/NzbDrone.Web/_backboneApp/Shared/NotificationView.js b/NzbDrone.Web/_backboneApp/Shared/NotificationView.js index acedefcfc..5d24d4890 100644 --- a/NzbDrone.Web/_backboneApp/Shared/NotificationView.js +++ b/NzbDrone.Web/_backboneApp/Shared/NotificationView.js @@ -2,7 +2,7 @@ /// NzbDrone.Shared.NotificationItemView = Backbone.Marionette.ItemView.extend({ - template: "Shared/NotificationTemplate", + template: 'Shared/NotificationTemplate', events: { 'click .x-close': 'kill' @@ -67,7 +67,7 @@ $(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) { model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText); model.set('message', xmlHttpRequest.responseText); model.set('level', 'error'); - NzbDrone.Shared.NotificationCollectionView.Instance.collection.add(model); + NzbDrone.Shared.NotificationCollectionView.Instance.collection.push(model); var suppressErrorAlert = false; return suppressErrorAlert; diff --git a/NzbDrone.Web/_backboneApp/app.js b/NzbDrone.Web/_backboneApp/app.js index 39d91f55a..67ab85355 100644 --- a/NzbDrone.Web/_backboneApp/app.js +++ b/NzbDrone.Web/_backboneApp/app.js @@ -17,10 +17,13 @@ if (typeof console === undefined) { } NzbDrone = new Backbone.Marionette.Application(); -NzbDrone.Series = NzbDrone.module('Series'); -NzbDrone.AddSeries = NzbDrone.module('AddSeries'); -NzbDrone.Quality = NzbDrone.module('Quality'); -NzbDrone.Shared = NzbDrone.module('Shared'); +NzbDrone.Series = {}; +NzbDrone.AddSeries = {}; +NzbDrone.AddSeries.New = {}; +NzbDrone.AddSeries.Existing = {}; +NzbDrone.AddSeries.RootFolders = {}; +NzbDrone.Quality = {}; +NzbDrone.Shared = {}; /* _.templateSettings = { diff --git a/NzbDrone.ncrunchsolution b/NzbDrone.ncrunchsolution index 13a4b6131..e88d63cdb 100644 --- a/NzbDrone.ncrunchsolution +++ b/NzbDrone.ncrunchsolution @@ -2,6 +2,7 @@ 1 False true + true UseDynamicAnalysis Disabled Disabled diff --git a/NzbDrone.sln.DotSettings b/NzbDrone.sln.DotSettings index 0c6ea2ed2..67947389c 100644 --- a/NzbDrone.sln.DotSettings +++ b/NzbDrone.sln.DotSettings @@ -38,6 +38,19 @@ $ModelName$Collection = Backbone.Collection.extend({ }); + True + True + Create a new Method + True + 0 + True + True + InJavaScriptFile + func + True + $name$: function () { + + }, @@ -78,6 +91,50 @@ $ModelName$Collection = Backbone.Collection.extend({ model True $ModelName$ = Backbone.M + True + True + Subscribe to event + True + 1 + True + typeMember() + 2 + True + 0 + True + True + InJavaScriptFile + vent + True + NzbDrone.vent.listenTo($Target$, '$Event$', this.$Handler$, this); + + True + True + True + 0 + True + 2 + True + 1 + True + True + InJavaScriptFile + events + True + events: { + '$event$ .x-$selector$': '$handler$' + }, + True + True + Add Initialize Method + True + True + InJavaScriptFile + init + True + initialize: function () { + + },