From 6ea0b16585cf5c71c8cc4a2d2bd54d15fcf076b5 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 11 Jul 2013 09:51:38 -0700 Subject: [PATCH] A little formating on add series --- UI/AddSeries/AddSeriesLayout.js | 16 ++++-- UI/AddSeries/AddSeriesView.js | 2 - .../RootFolderSelectionPartial.html | 2 +- UI/AddSeries/SearchResultTemplate.html | 26 ++++----- UI/AddSeries/SearchResultView.js | 55 +++++++++---------- 5 files changed, 51 insertions(+), 50 deletions(-) diff --git a/UI/AddSeries/AddSeriesLayout.js b/UI/AddSeries/AddSeriesLayout.js index 9f6a7969c..eb76f84f0 100644 --- a/UI/AddSeries/AddSeriesLayout.js +++ b/UI/AddSeries/AddSeriesLayout.js @@ -8,8 +8,15 @@ define( 'AddSeries/AddSeriesView', 'Quality/QualityProfileCollection', 'AddSeries/RootFolders/Collection', - 'Series/SeriesCollection', - ], function (App, Marionette, RootFolderLayout, ExistingSeriesCollectionView, AddSeriesView, qualityProfileCollection, rootFolderCollection, SeriesCollection) { + 'Series/SeriesCollection' + ], function (App, + Marionette, + RootFolderLayout, + ExistingSeriesCollectionView, + AddSeriesView, + QualityProfileCollection, + RootFolderCollection, + SeriesCollection) { return Marionette.Layout.extend({ template: 'AddSeries/AddSeriesLayoutTemplate', @@ -30,12 +37,11 @@ define( initialize: function () { SeriesCollection.fetch(); + QualityProfileCollection.fetch(); + RootFolderCollection.fetch(); this.rootFolderLayout = new RootFolderLayout(); this.rootFolderLayout.on('folderSelected', this._folderSelected, this); - - qualityProfileCollection.fetch(); - rootFolderCollection.fetch(); }, onShow: function () { diff --git a/UI/AddSeries/AddSeriesView.js b/UI/AddSeries/AddSeriesView.js index 933e964eb..5694c3718 100644 --- a/UI/AddSeries/AddSeriesView.js +++ b/UI/AddSeries/AddSeriesView.js @@ -44,7 +44,6 @@ define( } }, - _onSeriesAdded: function (options) { if (options.series.get('path') === this.model.get('folder').path) { this.close(); @@ -54,7 +53,6 @@ define( onRender: function () { var self = this; - this.$el.addClass(this.className); this.ui.seriesSearch.data('timeout', null).keyup(function () { diff --git a/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html b/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html index 97a8b7be1..6df653946 100644 --- a/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html +++ b/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html @@ -1,6 +1,6 @@  diff --git a/UI/AddSeries/SearchResultTemplate.html b/UI/AddSeries/SearchResultTemplate.html index 0b5792540..e60f15039 100644 --- a/UI/AddSeries/SearchResultTemplate.html +++ b/UI/AddSeries/SearchResultTemplate.html @@ -16,20 +16,20 @@
{{#if existing}} -
- Already Exists -
+
+ Already Exists +
{{else}} -
- Add - -
- {{#unless path}} - {{> RootFolderSelectionPartial rootFolders}} - {{/unless}} -
- {{> QualityProfileSelectionPartial qualityProfiles}} -
+
+ Add + +
+ {{#unless path}} + {{> RootFolderSelectionPartial rootFolders}} + {{/unless}} +
+ {{> QualityProfileSelectionPartial qualityProfiles}} +
{{/if}}
diff --git a/UI/AddSeries/SearchResultView.js b/UI/AddSeries/SearchResultView.js index 939b32c99..e9b4a4da3 100644 --- a/UI/AddSeries/SearchResultView.js +++ b/UI/AddSeries/SearchResultView.js @@ -36,6 +36,32 @@ define( this.listenTo(this.model, 'change', this.render); }, + onRender: function () { + + var defaultQuality = Config.GetValue(Config.Keys.DefaultQualityProfileId); + + if (QualityProfiles.get(defaultQuality)) { + this.ui.qualityProfile.val(defaultQuality); + } + }, + + serializeData: function () { + var data = this.model.toJSON(); + + var existingSeries = SeriesCollection.where({tvdbId: this.model.get('tvdbId')}); + + if (existingSeries.length > 0) { + data.existing = existingSeries[0].toJSON(); + } + + data.qualityProfiles = QualityProfiles.toJSON(); + + if (!data.isExisting) { + data.rootFolders = RootFolders.toJSON(); + } + + return data; + }, _onConfigUpdated: function (options) { @@ -48,15 +74,6 @@ define( Config.SetValue(Config.Keys.DefaultQualityProfileId, this.ui.qualityProfile.val()); }, - onRender: function () { - - var defaultQuality = Config.GetValue(Config.Keys.DefaultQualityProfileId); - - if (QualityProfiles.get(defaultQuality)) { - this.ui.qualityProfile.val(defaultQuality); - } - }, - _addSeries: function () { var icon = this.ui.addButton.find('icon'); icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled'); @@ -83,26 +100,6 @@ define( }).fail(function () { icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); }); - - }, - - serializeData: function () { - var data = this.model.toJSON(); - - var existingSeries = SeriesCollection.where({tvdbId: this.model.get('tvdbId')}); - - if (existingSeries.length > 0) { - data.existing = existingSeries[0].toJSON(); - } - - data.qualityProfiles = QualityProfiles.toJSON(); - - if (!data.isExisting) { - data.rootFolders = RootFolders.toJSON(); - } - - return data; } }); - });