From 85fd4248a63709f4dafff0e073dbb6ddba2e8079 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 21 Feb 2013 22:18:36 -0800 Subject: [PATCH] minor js cleanup. --- NzbDrone.Backbone/.idea/codeStyleSettings.xml | 9 +++++++ .../.idea/dictionaries/Keivan.xml | 7 ++++++ .../AddSeries/AddSeriesLayout.js | 12 +++++----- .../AddSeries/New/AddNewSeriesView.js | 11 ++++----- .../AddSeries/New/SearchResultView.js | 5 ++-- .../RootFolders/RootFolderItemTemplate.html | 4 ++-- NzbDrone.Backbone/Mixins/backbone.ajax.js | 24 +------------------ 7 files changed, 32 insertions(+), 40 deletions(-) create mode 100644 NzbDrone.Backbone/.idea/codeStyleSettings.xml create mode 100644 NzbDrone.Backbone/.idea/dictionaries/Keivan.xml diff --git a/NzbDrone.Backbone/.idea/codeStyleSettings.xml b/NzbDrone.Backbone/.idea/codeStyleSettings.xml new file mode 100644 index 000000000..1129f0010 --- /dev/null +++ b/NzbDrone.Backbone/.idea/codeStyleSettings.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/NzbDrone.Backbone/.idea/dictionaries/Keivan.xml b/NzbDrone.Backbone/.idea/dictionaries/Keivan.xml new file mode 100644 index 000000000..8999e31fe --- /dev/null +++ b/NzbDrone.Backbone/.idea/dictionaries/Keivan.xml @@ -0,0 +1,7 @@ + + + + rootfolder + + + \ No newline at end of file diff --git a/NzbDrone.Backbone/AddSeries/AddSeriesLayout.js b/NzbDrone.Backbone/AddSeries/AddSeriesLayout.js index cc61e624b..8b73c08b2 100644 --- a/NzbDrone.Backbone/AddSeries/AddSeriesLayout.js +++ b/NzbDrone.Backbone/AddSeries/AddSeriesLayout.js @@ -1,10 +1,10 @@ define([ - 'app', - 'AddSeries/RootFolders/RootFolderCollection', - 'Quality/QualityProfileCollection', - 'AddSeries/RootFolders/RootFolderView', - 'AddSeries/New/AddNewSeriesView', - 'AddSeries/Existing/ImportSeriesView' + 'app', + 'AddSeries/RootFolders/RootFolderCollection', + 'Quality/QualityProfileCollection', + 'AddSeries/RootFolders/RootFolderView', + 'AddSeries/New/AddNewSeriesView', + 'AddSeries/Existing/ImportSeriesView' ], function (app, rootFolderCollection, qualityProfileCollection) { NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({ diff --git a/NzbDrone.Backbone/AddSeries/New/AddNewSeriesView.js b/NzbDrone.Backbone/AddSeries/New/AddNewSeriesView.js index 1d7626e12..09bed9258 100644 --- a/NzbDrone.Backbone/AddSeries/New/AddNewSeriesView.js +++ b/NzbDrone.Backbone/AddSeries/New/AddNewSeriesView.js @@ -1,5 +1,4 @@ -define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/SearchResultView', 'Shared/SpinnerView'], function (app, rootFolders) { - +define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/SearchResultView', 'Shared/SpinnerView'], function () { NzbDrone.AddSeries.New.AddNewSeriesView = Backbone.Marionette.Layout.extend({ template: 'AddSeries/New/AddNewSeriesTemplate', route: 'Series/add/new', @@ -35,18 +34,18 @@ var term = context.ui.seriesSearch.val(); context.collection.reset(); - if (term !== '') { + if (term === '') { + context.searchResult.close(); + } else { context.searchResult.show(new NzbDrone.Shared.SpinnerView()); context.currentSearchRequest = context.collection.fetch({ data: { term: term }, - success: function (model) { + success: function () { context.searchResult.show(context.resultView); } }); - } else { - context.searchResult.close(); } }, diff --git a/NzbDrone.Backbone/AddSeries/New/SearchResultView.js b/NzbDrone.Backbone/AddSeries/New/SearchResultView.js index 416d079b7..f1d104bdf 100644 --- a/NzbDrone.Backbone/AddSeries/New/SearchResultView.js +++ b/NzbDrone.Backbone/AddSeries/New/SearchResultView.js @@ -28,7 +28,7 @@ define(['app','Shared/NotificationCollection', 'AddSeries/SearchResultCollection var quality = this.ui.qualityProfile.val(); var rootFolderId = this.ui.rootFolder.val(); - //Todo: This wiil create an invalid path on linux... + //Todo: This will create an invalid path on linux... var rootPath = this.model.get('rootFolders').get(rootFolderId).get('path'); var path = rootPath + "\\" + title; @@ -62,11 +62,10 @@ define(['app','Shared/NotificationCollection', 'AddSeries/SearchResultCollection NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({ itemView: NzbDrone.AddSeries.New.SearchItemView, - className: 'accordion', - initialize: function () { this.listenTo(this.collection, 'reset', this.render); } + }); }); diff --git a/NzbDrone.Backbone/AddSeries/RootFolders/RootFolderItemTemplate.html b/NzbDrone.Backbone/AddSeries/RootFolders/RootFolderItemTemplate.html index 03dff6155..e0408702a 100644 --- a/NzbDrone.Backbone/AddSeries/RootFolders/RootFolderItemTemplate.html +++ b/NzbDrone.Backbone/AddSeries/RootFolders/RootFolderItemTemplate.html @@ -1,8 +1,8 @@ - +
-
+ diff --git a/NzbDrone.Backbone/Mixins/backbone.ajax.js b/NzbDrone.Backbone/Mixins/backbone.ajax.js index 43e688804..e4e0df4fb 100644 --- a/NzbDrone.Backbone/Mixins/backbone.ajax.js +++ b/NzbDrone.Backbone/Mixins/backbone.ajax.js @@ -25,26 +25,4 @@ } }; -} ()); - -/* - -var xhrMixin = function (){ - console.log ('mixing in xhr'); - - var originalOnRender = Backbone.Marionette.View.prototype.onRender; - var originalBeforeClose = Backbone.Marionette.View.prototype.beforeClose; - - Backbone.Marionette.View.prototype.onRender = function (){ - console.log ('render'); - if (originalOnRender){ - originalOnRender.call (this); - } - }; - Backbone.Marionette.View.prototype.beforeClose = function (){ - console.log ('beforeClose'); - if (originalBeforeClose){ - originalBeforeClose.call (this); - } - }; -} ();*/ +} ()); \ No newline at end of file