diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 84d090721..b3106e9e3 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -185,6 +185,7 @@ + @@ -373,7 +374,7 @@ - + diff --git a/NzbDrone.Web/_backboneApp/AddSeries/addNewSeriesTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/addNewSeriesTemplate.html new file mode 100644 index 000000000..bd64011d2 --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/addNewSeriesTemplate.html @@ -0,0 +1,6 @@ +
+ +
diff --git a/NzbDrone.Web/_backboneApp/AddSeries/addSeriesTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesLayoutTemplate.html similarity index 59% rename from NzbDrone.Web/_backboneApp/AddSeries/addSeriesTemplate.html rename to NzbDrone.Web/_backboneApp/AddSeries/addSeriesLayoutTemplate.html index b3acf6c2a..be8066b56 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/addSeriesTemplate.html +++ b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesLayoutTemplate.html @@ -4,12 +4,7 @@
  • Root Folders
  • -
    - -
    +
    Add new series.
    Import existing.
    Manage root folders
    diff --git a/NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js index 87f238c34..1d194baa2 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js @@ -1,80 +1,56 @@ -NzbDrone.AddSeriesView = Backbone.Marionette.ItemView.extend({ - template: "AddSeries/addSeriesTemplate", - - initialise: function () { - }, - - onRender: function () { - this.$el.find('#myTab a').click(function (e) { - e.preventDefault(); - $(this).tab('show'); - }); - }, - -}); - -NzbDrone.AddNewSeriesView = Backbone.Marionette.ItemView.extend({ - template: "#add-new-series", +NzbDrone.AddNewSeriesView = Backbone.Marionette.ItemView.extend({ + template: "AddSeries/addNewSeriesTemplate", ui: { - seriesSearch: '#series-search' + seriesSearch: '.search input' }, onRender: function () { - console.log('binding auto complete'); var self = this; this.ui.seriesSearch - .autocomplete({ - source: "http://localhost:1232/api/series/lookup", - minLength: 1, - delay: 500, - select: function (event, ui) { - $(this).val(ui.item.Title); - $(this).siblings('.seriesId').val(ui.item.Id); - return false; - }, - open: function (event, ui) { - $('.ui-autocomplete').addClass('seriesLookupResults'); - }, - close: function (event, ui) { - $('.ui-autocomplete').removeClass('seriesLookupResults'); - } + .data('timeout', null) + .keyup(function () { + clearTimeout(self.$el.data('timeout')); + self.$el.data('timeout', setTimeout(self.search, 500, self)); + }); + }, - }) - .data("autocomplete")._renderItem = function (ul, item) { + search: function (context) { + console.log(context.ui.seriesSearch.val()); + }, +}); + +NzbDrone.ImportExistingView = Backbone.Marionette.ItemView.extend({ + template: "AddSeries/ImportExistingTemplate", - return $("
  • ") - .data("item.autocomplete", item) - .append("" + item.SeriesName + "") - .appendTo(ul); - }; - } }); -NzbDrone.AddExistingSeriesView = Backbone.Marionette.ItemView.extend({ - template: "#add-existing-series", +NzbDrone.RootFoldersView = Backbone.Marionette.ItemView.extend({ + template: "AddSeries/RootFoldersTemplate", - events: { - 'click #single': 'single', - 'click #multiple': 'multiple' - }, +}); + +NzbDrone.AddSeriesLayout = Backbone.Marionette.Layout.extend({ + template: "AddSeries/addSeriesLayoutTemplate", - single: function () { - NzbDrone.Router.navigate(NzbDrone.Routes.Series.AddExistingSingle, { trigger: true }); + regions: { + addNew: "#add-new", + importExisting: "#import-existing", + rootFolders: "#root-folders" }, - multiple: function () { - NzbDrone.Router.navigate(NzbDrone.Routes.Series.AddExistingMultiple, { trigger: true }); - } -}); + onRender: function () { + this.$('#myTab a').click(function (e) { + e.preventDefault(); + $(this).tab('show'); + }); -NzbDrone.AddExistingSeriesSingleView = Backbone.Marionette.ItemView.extend({ - template: "#add-existing-series-single" -}); + this.addNew.show(new NzbDrone.AddNewSeriesView()); + this.importExisting.show(new NzbDrone.ImportExistingView()); + this.rootFolders.show(new NzbDrone.RootFoldersView()); + }, -NzbDrone.AddExistingSeriesMultipleView = Backbone.Marionette.ItemView.extend({ - template: "#add-existing-series-multiple" -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/app.js b/NzbDrone.Web/_backboneApp/app.js index 9bceadcee..944186fcb 100644 --- a/NzbDrone.Web/_backboneApp/app.js +++ b/NzbDrone.Web/_backboneApp/app.js @@ -21,7 +21,7 @@ NzbDrone.Routes = { NzbDrone.Controller = Backbone.Marionette.Controller.extend({ addSeries: function () { - NzbDrone.mainRegion.show(new NzbDrone.AddSeriesView()); + NzbDrone.mainRegion.show(new NzbDrone.AddSeriesLayout()); },