From 97eb5ffc61e4db502bb88b8dd59ac81cd57b406a Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 9 Sep 2013 23:22:54 -0700 Subject: [PATCH] Default to starting at lowest season above 0 --- NzbDrone.Core/MetadataSource/TraktProxy.cs | 2 +- .../RootFolders/RootFolderSelectionPartial.html | 2 +- .../StartingSeasonSelectionPartial.html | 9 +++++++++ UI/AddSeries/SearchResultView.js | 15 +++++++++++---- ...emplate.html => SearchResultViewTemplate.html} | 15 +++++++-------- 5 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 UI/AddSeries/RootFolders/StartingSeasonSelectionPartial.html rename UI/AddSeries/{SearchResultTemplate.html => SearchResultViewTemplate.html} (70%) diff --git a/NzbDrone.Core/MetadataSource/TraktProxy.cs b/NzbDrone.Core/MetadataSource/TraktProxy.cs index 53fd0c4e7..eb8bb263e 100644 --- a/NzbDrone.Core/MetadataSource/TraktProxy.cs +++ b/NzbDrone.Core/MetadataSource/TraktProxy.cs @@ -83,7 +83,7 @@ namespace NzbDrone.Core.MetadataSource series.Seasons = show.seasons.Select(s => new Tv.Season { SeasonNumber = s.season - }).ToList(); + }).OrderByDescending(s => s.SeasonNumber).ToList(); series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Banner, Url = show.images.banner }); series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Poster, Url = GetPosterThumbnailUrl(show.images.poster) }); diff --git a/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html b/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html index 60f2a49d7..56d547da5 100644 --- a/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html +++ b/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html @@ -1,4 +1,4 @@ - {{#if this}} {{#each this}} diff --git a/UI/AddSeries/RootFolders/StartingSeasonSelectionPartial.html b/UI/AddSeries/RootFolders/StartingSeasonSelectionPartial.html new file mode 100644 index 000000000..0827ba052 --- /dev/null +++ b/UI/AddSeries/RootFolders/StartingSeasonSelectionPartial.html @@ -0,0 +1,9 @@ + diff --git a/UI/AddSeries/SearchResultView.js b/UI/AddSeries/SearchResultView.js index e7d16631a..28ba1a774 100644 --- a/UI/AddSeries/SearchResultView.js +++ b/UI/AddSeries/SearchResultView.js @@ -3,7 +3,6 @@ define( [ 'app', 'marionette', - 'Quality/QualityProfileCollection', 'AddSeries/RootFolders/Collection', 'AddSeries/RootFolders/Layout', @@ -15,13 +14,14 @@ define( return Marionette.ItemView.extend({ - template: 'AddSeries/SearchResultTemplate', + template: 'AddSeries/SearchResultViewTemplate', ui: { qualityProfile: '.x-quality-profile', rootFolder : '.x-root-folder', addButton : '.x-add', - overview : '.x-overview' + overview : '.x-overview', + startingSeason: '.x-starting-season' }, events: { @@ -57,6 +57,12 @@ define( this.ui.rootFolder.val(defaultRoot); } + var minSeasonNotZero = _.min(_.reject(this.model.get('seasons'), { seasonNumber: 0 }), 'seasonNumber'); + + if (minSeasonNotZero) { + this.ui.startingSeason.val(minSeasonNotZero.seasonNumber); + } + //TODO: make this work via onRender, FM? //works with onShow, but stops working after the first render this.ui.overview.dotdotdot({ @@ -117,15 +123,16 @@ define( var quality = this.ui.qualityProfile.val(); var rootFolderPath = this.ui.rootFolder.children(':selected').text(); + var startingSeason = this.ui.startingSeason.val(); this.model.set('qualityProfileId', quality); this.model.set('rootFolderPath', rootFolderPath); + this.model.setSeasonPass(startingSeason); var self = this; SeriesCollection.add(this.model); - this.model.save().done(function () { self.close(); icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); diff --git a/UI/AddSeries/SearchResultTemplate.html b/UI/AddSeries/SearchResultViewTemplate.html similarity index 70% rename from UI/AddSeries/SearchResultTemplate.html rename to UI/AddSeries/SearchResultViewTemplate.html index 47ec8a9b3..27d7dcd0e 100644 --- a/UI/AddSeries/SearchResultTemplate.html +++ b/UI/AddSeries/SearchResultViewTemplate.html @@ -15,22 +15,21 @@
{{#if existing}} -
+
Already Exists
{{else}} -
- Add - -
{{#unless path}} {{> RootFolderSelectionPartial rootFolders}} {{/unless}} -
- {{> QualityProfileSelectionPartial qualityProfiles}} + + {{> StartingSeasonSelectionPartial seasons}} + {{> QualityProfileSelectionPartial qualityProfiles}} + +
+ Add
{{/if}} -