Default to starting at lowest season above 0

pull/4/head
Mark McDowall 11 years ago
parent 33986a9185
commit 97eb5ffc61

@ -83,7 +83,7 @@ namespace NzbDrone.Core.MetadataSource
series.Seasons = show.seasons.Select(s => new Tv.Season series.Seasons = show.seasons.Select(s => new Tv.Season
{ {
SeasonNumber = s.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.Banner, Url = show.images.banner });
series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Poster, Url = GetPosterThumbnailUrl(show.images.poster) }); series.Images.Add(new MediaCover.MediaCover { CoverType = MediaCoverTypes.Poster, Url = GetPosterThumbnailUrl(show.images.poster) });

@ -1,4 +1,4 @@
<select class="span6 x-root-folder"> <select class="span4 x-root-folder">
{{#if this}} {{#if this}}
{{#each this}} {{#each this}}
<option value="{{id}}">{{path}}</option> <option value="{{id}}">{{path}}</option>

@ -0,0 +1,9 @@
<select class="span2 x-starting-season">
{{#each this}}
{{#if_eq seasonNumber compare="0"}}
<option value="{{seasonNumber}}">Specials</option>
{{else}}
<option value="{{seasonNumber}}">Season {{seasonNumber}}</option>
{{/if_eq}}
{{/each}}
</select>

@ -3,7 +3,6 @@ define(
[ [
'app', 'app',
'marionette', 'marionette',
'Quality/QualityProfileCollection', 'Quality/QualityProfileCollection',
'AddSeries/RootFolders/Collection', 'AddSeries/RootFolders/Collection',
'AddSeries/RootFolders/Layout', 'AddSeries/RootFolders/Layout',
@ -15,13 +14,14 @@ define(
return Marionette.ItemView.extend({ return Marionette.ItemView.extend({
template: 'AddSeries/SearchResultTemplate', template: 'AddSeries/SearchResultViewTemplate',
ui: { ui: {
qualityProfile: '.x-quality-profile', qualityProfile: '.x-quality-profile',
rootFolder : '.x-root-folder', rootFolder : '.x-root-folder',
addButton : '.x-add', addButton : '.x-add',
overview : '.x-overview' overview : '.x-overview',
startingSeason: '.x-starting-season'
}, },
events: { events: {
@ -57,6 +57,12 @@ define(
this.ui.rootFolder.val(defaultRoot); 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? //TODO: make this work via onRender, FM?
//works with onShow, but stops working after the first render //works with onShow, but stops working after the first render
this.ui.overview.dotdotdot({ this.ui.overview.dotdotdot({
@ -117,15 +123,16 @@ define(
var quality = this.ui.qualityProfile.val(); var quality = this.ui.qualityProfile.val();
var rootFolderPath = this.ui.rootFolder.children(':selected').text(); var rootFolderPath = this.ui.rootFolder.children(':selected').text();
var startingSeason = this.ui.startingSeason.val();
this.model.set('qualityProfileId', quality); this.model.set('qualityProfileId', quality);
this.model.set('rootFolderPath', rootFolderPath); this.model.set('rootFolderPath', rootFolderPath);
this.model.setSeasonPass(startingSeason);
var self = this; var self = this;
SeriesCollection.add(this.model); SeriesCollection.add(this.model);
this.model.save().done(function () { this.model.save().done(function () {
self.close(); self.close();
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');

@ -15,22 +15,21 @@
</div> </div>
<div class="row"> <div class="row">
{{#if existing}} {{#if existing}}
<div class="btn pull-right add-series disabled"> <div class="btn add-series disabled pull-right">
Already Exists Already Exists
</div> </div>
{{else}} {{else}}
<div class="btn btn-success x-add pull-right add-series">
Add
<icon class="icon-plus"></icon>
</div>
{{#unless path}} {{#unless path}}
{{> RootFolderSelectionPartial rootFolders}} {{> RootFolderSelectionPartial rootFolders}}
{{/unless}} {{/unless}}
<div class='pull-right'>
{{> QualityProfileSelectionPartial qualityProfiles}} {{> StartingSeasonSelectionPartial seasons}}
{{> QualityProfileSelectionPartial qualityProfiles}}
<div class="span1 btn btn-success x-add add-series pull-right">
Add <i class="icon-plus"></i>
</div> </div>
{{/if}} {{/if}}
</div> </div>
</div> </div>
</div> </div>
Loading…
Cancel
Save