From d110cf2633bd7888ea0f5af5152159166df75495 Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Tue, 22 Jan 2013 15:58:08 -0800 Subject: [PATCH] updated cassette registration --- NzbDrone.Web/NzbDrone.Web.csproj | 6 +- .../AddNewSeriesTemplate.html} | 0 .../AddNewSeries/AddNewSeriesView.js | 27 +++++++++ .../_backboneApp/AddSeries/AddSeriesLayout.js | 24 ++++++++ .../AddSeries/SeriesSearchModel.js | 10 ++++ .../_backboneApp/AddSeries/addSeriesView.js | 56 ------------------- .../_backboneApp/CassetteConfiguration.cs | 24 ++++---- NzbDrone.Web/_backboneApp/app.js | 14 ++++- 8 files changed, 89 insertions(+), 72 deletions(-) rename NzbDrone.Web/_backboneApp/AddSeries/{addNewSeriesTemplate.html => AddNewSeries/AddNewSeriesTemplate.html} (100%) create mode 100644 NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js create mode 100644 NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js create mode 100644 NzbDrone.Web/_backboneApp/AddSeries/SeriesSearchModel.js delete mode 100644 NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index b3106e9e3..ca7bfbfae 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -185,7 +185,9 @@ - + + + @@ -196,7 +198,7 @@ - + diff --git a/NzbDrone.Web/_backboneApp/AddSeries/addNewSeriesTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesTemplate.html similarity index 100% rename from NzbDrone.Web/_backboneApp/AddSeries/addNewSeriesTemplate.html rename to NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesTemplate.html diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js b/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js new file mode 100644 index 000000000..efc9477f3 --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js @@ -0,0 +1,27 @@ +/// +/// + +NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.ItemView.extend({ + template: "AddSeries/AddNewSeries/AddNewSeriesTemplate", + + ui: { + seriesSearch: '.search input' + }, + + onRender: function() { + + console.log('binding auto complete'); + var self = this; + + this.ui.seriesSearch + .data('timeout', null) + .keyup(function() { + clearTimeout(self.$el.data('timeout')); + self.$el.data('timeout', setTimeout(self.search, 500, self)); + }); + }, + + search: function(context) { + console.log(context.ui.seriesSearch.val()); + }, +}); \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js b/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js new file mode 100644 index 000000000..127a1b942 --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js @@ -0,0 +1,24 @@ +/// +/// + +NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({ + template: "AddSeries/addSeriesLayoutTemplate", + + regions: { + addNew: "#add-new", + importExisting: "#import-existing", + rootFolders: "#root-folders" + }, + + onRender: function () { + this.$('#myTab a').click(function (e) { + e.preventDefault(); + $(this).tab('show'); + }); + + this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView()); + //this.importExisting.show(new NzbDrone.ImportExistingView()); + //this.rootFolders.show(new NzbDrone.RootFoldersView()); + }, + +}); \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/AddSeries/SeriesSearchModel.js b/NzbDrone.Web/_backboneApp/AddSeries/SeriesSearchModel.js new file mode 100644 index 000000000..42c95ccc3 --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/SeriesSearchModel.js @@ -0,0 +1,10 @@ +/// + +NzbDrone.AddSeries.SeriesSearchResultModel = Backbone.Model.extend({ + +}); + +NzbDrone.AddSeries.SeriesSearchResultCollection = Backbone.Collection.extend({ + +}); + diff --git a/NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js deleted file mode 100644 index 1d194baa2..000000000 --- a/NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js +++ /dev/null @@ -1,56 +0,0 @@ -NzbDrone.AddNewSeriesView = Backbone.Marionette.ItemView.extend({ - template: "AddSeries/addNewSeriesTemplate", - - ui: { - seriesSearch: '.search input' - }, - - onRender: function () { - - console.log('binding auto complete'); - var self = this; - - this.ui.seriesSearch - .data('timeout', null) - .keyup(function () { - clearTimeout(self.$el.data('timeout')); - self.$el.data('timeout', setTimeout(self.search, 500, self)); - }); - }, - - search: function (context) { - console.log(context.ui.seriesSearch.val()); - }, -}); - -NzbDrone.ImportExistingView = Backbone.Marionette.ItemView.extend({ - template: "AddSeries/ImportExistingTemplate", - -}); - -NzbDrone.RootFoldersView = Backbone.Marionette.ItemView.extend({ - template: "AddSeries/RootFoldersTemplate", - -}); - -NzbDrone.AddSeriesLayout = Backbone.Marionette.Layout.extend({ - template: "AddSeries/addSeriesLayoutTemplate", - - regions: { - addNew: "#add-new", - importExisting: "#import-existing", - rootFolders: "#root-folders" - }, - - onRender: function () { - this.$('#myTab a').click(function (e) { - e.preventDefault(); - $(this).tab('show'); - }); - - this.addNew.show(new NzbDrone.AddNewSeriesView()); - this.importExisting.show(new NzbDrone.ImportExistingView()); - this.rootFolders.show(new NzbDrone.RootFoldersView()); - }, - -}); \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs b/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs index b51a9da7d..0af5cb438 100644 --- a/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs +++ b/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs @@ -18,7 +18,7 @@ namespace NzbDrone.Web.Backbone.NzbDrone { bundles.AddUrlWithAlias("//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,600,300'", FONTS); - //bundles.AddPerSubDirectory("Backbone.NzbDrone"); + bundles.AddPerIndividualFile(APP_PATH); bundles.Add(BASE_STYLE, new[]{ APP_PATH + "\\Content\\Bootstrap\\bootstrap.less", @@ -28,20 +28,20 @@ namespace NzbDrone.Web.Backbone.NzbDrone }, bundle => bundle.AddReference("/" + FONTS)); - bundles.Add(BACKBONE, new[]{ - APP_PATH + "\\JsLibraries\\jquery-1.8.2.js", - APP_PATH + "\\JsLibraries\\bootstrap.js", - APP_PATH + "\\JsLibraries\\underscore.js", - APP_PATH + "\\JsLibraries\\backbone.js", - APP_PATH + "\\JsLibraries\\backbone.marionette.js", - APP_PATH + "\\JsLibraries\\backbone.marionette.extend.js", + + + bundles.Add(NZBDRONE, new[]{ + APP_PATH + "\\AddSeries\\AddSeriesLayout.js", + }); - bundles.Add(NZBDRONE, new[]{ - APP_PATH + "\\app.js", - APP_PATH + "\\AddSeries\\addSeriesView.js"}, - bundle => bundle.AddReference("/" + BACKBONE)); +/* bundles.Add(NZBDRONE, new[]{ + + }, + bundle => bundle.AddReference("/" + BACKBONE));*/ + + } } } \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/app.js b/NzbDrone.Web/_backboneApp/app.js index 944186fcb..d5383578e 100644 --- a/NzbDrone.Web/_backboneApp/app.js +++ b/NzbDrone.Web/_backboneApp/app.js @@ -1,4 +1,14 @@ -NzbDrone = new Backbone.Marionette.Application(); +/// +/// +/// +/// +/// +/// + + + +NzbDrone = new Backbone.Marionette.Application(); +NzbDrone.AddSeries = NzbDrone.module("AddSeries"); NzbDrone.Constants = { @@ -21,7 +31,7 @@ NzbDrone.Routes = { NzbDrone.Controller = Backbone.Marionette.Controller.extend({ addSeries: function () { - NzbDrone.mainRegion.show(new NzbDrone.AddSeriesLayout()); + NzbDrone.mainRegion.show(new NzbDrone.AddSeries.AddNewSeriesView()); },