diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 46c36bf71..2a1c25128 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -182,6 +182,7 @@ + @@ -396,7 +397,7 @@ - + diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js b/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js index e425004dd..df668b338 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/AddNewSeriesView.js @@ -1,26 +1,5 @@ /// -/// -/// - -NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({ - - template: "AddSeries/AddNewSeries/SearchResultTemplate", - className: 'search-item-view well', - onRender: function () { - NzbDrone.ModelBinder.bind(this.model, this.el); - } - -}); - -NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({ - - itemView: NzbDrone.AddSeries.SearchItemView, - - initialize: function () { - this.listenTo(this.collection, 'reset', this.render); - }, - -}); +/// NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({ template: "AddSeries/AddNewSeries/AddNewSeriesTemplate", @@ -36,6 +15,13 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({ collection: new NzbDrone.AddSeries.SearchResultCollection(), + initialize: function (rootFolders) { + if (rootFolders === undefined) { + throw "rootFolder arg is required."; + } + + this.rootFoldersCollection = rootFolders; + }, onRender: function () { console.log('binding auto complete'); @@ -62,13 +48,22 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({ context.collection.fetch({ data: $.param({ term: term }), - success: function () { - context.searchResult.show(context.resultView); + success: function (model) { + context.resultUpdated(model, context); } - }); + } else { context.searchResult.close(); } }, + + + resultUpdated: function (options, context) { + _.each(options.models, function (model) { + model.set('rootFolders', context.rootFoldersCollection.rootFolders.models); + }); + + context.searchResult.show(context.resultView); + } }); \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultTemplate.html index fdaab6ae8..a50cfd853 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultTemplate.html +++ b/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultTemplate.html @@ -1,5 +1,22 @@ -
-
- {{seriesName}} {{seriesYear}} + +
+
+ + +
+
+
diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultView.js b/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultView.js new file mode 100644 index 000000000..796cc235e --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/AddNewSeries/SearchResultView.js @@ -0,0 +1,25 @@ +/// +/// +/// + +NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({ + + template: "AddSeries/AddNewSeries/SearchResultTemplate", + className: 'search-item accordion-group', + onRender: function () { + this.listenTo(this.model, 'change', this.render); + } + +}); + +NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({ + + itemView: NzbDrone.AddSeries.SearchItemView, + + className: 'accordion', + + initialize: function () { + this.listenTo(this.collection, 'reset', this.render); + }, + +}); diff --git a/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js b/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js index 8b0fa4edc..cff69b2a6 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/AddSeriesLayout.js @@ -28,7 +28,7 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({ $(this).tab('show'); }); - this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView()); + this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView({ rootFolders: this.rootFolderCollection })); //this.importExisting.show(new NzbDrone.ImportExistingView()); this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection })); diff --git a/NzbDrone.Web/_backboneApp/AddSeries/addSeries.css b/NzbDrone.Web/_backboneApp/AddSeries/addSeries.css index 1c0aef6a7..dd2a4b83b 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/addSeries.css +++ b/NzbDrone.Web/_backboneApp/AddSeries/addSeries.css @@ -8,7 +8,7 @@ } .nz-input-large *[class*='icon-'] { - font-size: 30px; + font-size: 28px; height: 30px; width: 40px; padding-top: 14px; @@ -23,20 +23,29 @@ .result-list .well:hover { background-color: #fcf8e3; + cursor: pointer; } -.result-item { - padding-left: 20px; -} -.result-item *[class*='icon-'] { - padding-right: 10px; +.search-item .accordion-heading *[class*='icon-'] { + padding-right: 5px; + padding-top: 10px; + padding-left: 10px; } .result-list .result-item a { font-size: 20px; } - .result-list .result-item a:hover { - text-decoration: none; - } +.search-item a:hover { + text-decoration: none; +} + +.search-item a { + color: #343434; +} + + +.search-item select { + font-size: 16px; +} diff --git a/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.extend.js b/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.extend.js index 60fd10617..e3eb9fe30 100644 --- a/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.extend.js +++ b/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.extend.js @@ -1,4 +1,6 @@ -_.extend(Marionette.TemplateCache.prototype, { +/// + +_.extend(Marionette.TemplateCache.prototype, { loadTemplate: function (templateId) { @@ -24,9 +26,9 @@ } }); +_.extend(Marionette.TemplateCache.prototype, { -_.extend(Marionette.View.prototype, { - - - + compileTemplate: function (rawTemplate) { + return Handlebars.compile(rawTemplate); + } }); \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/JsLibraries/marionette.viewswapper.js b/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.viewswapper.js similarity index 100% rename from NzbDrone.Web/_backboneApp/JsLibraries/marionette.viewswapper.js rename to NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.viewswapper.js diff --git a/NzbDrone.Web/_backboneApp/Shared/ErrorView.js b/NzbDrone.Web/_backboneApp/Shared/ErrorView.js index 95b999341..e147cf517 100644 --- a/NzbDrone.Web/_backboneApp/Shared/ErrorView.js +++ b/NzbDrone.Web/_backboneApp/Shared/ErrorView.js @@ -47,22 +47,20 @@ window.onerror = function (msg, url, line) { } var suppressErrorAlert = false; - // If you return true, then error alerts (like in older versions of - // Internet Explorer) will be suppressed. return suppressErrorAlert; }; -$(document).ajaxError(function (event, XMLHttpRequest, ajaxOptionsa) { +$(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) { + + if (xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) return; var errorView = NzbDrone.Shared.ErrorView.instance; var model = new NzbDrone.Shared.ErrorModel(); - model.set('title', ajaxOptionsa.url + " : " + XMLHttpRequest.statusText); - model.set('message', XMLHttpRequest.responseText); + model.set('title', ajaxOptions.url + " : " + xmlHttpRequest.statusText); + model.set('message', xmlHttpRequest.responseText); errorView.collection.add(model); var suppressErrorAlert = false; - // If you return true, then error alerts (like in older versions of - // Internet Explorer) will be suppressed. return suppressErrorAlert; }); \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/app.js b/NzbDrone.Web/_backboneApp/app.js index ac7d8c2a4..f8790cd3c 100644 --- a/NzbDrone.Web/_backboneApp/app.js +++ b/NzbDrone.Web/_backboneApp/app.js @@ -8,6 +8,7 @@ /// /// /// +/// /// /// /// @@ -20,9 +21,11 @@ NzbDrone = new Backbone.Marionette.Application(); NzbDrone.AddSeries = NzbDrone.module("AddSeries"); NzbDrone.Shared = NzbDrone.module("Shared"); +/* _.templateSettings = { interpolate: /\{\{([\s\S]+?)\}\}/g }; +*/ NzbDrone.ModelBinder = new Backbone.ModelBinder();