Default to starting at lowest season above 0

This commit is contained in:
Mark McDowall 2013-09-09 23:22:54 -07:00
parent 33986a9185
commit 97eb5ffc61
5 changed files with 29 additions and 14 deletions

View File

@ -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) });

View File

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

View File

@ -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>

View File

@ -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');

View File

@ -15,22 +15,21 @@
</div>
<div class="row">
{{#if existing}}
<div class="btn pull-right add-series disabled">
<div class="btn add-series disabled pull-right">
Already Exists
</div>
{{else}}
<div class="btn btn-success x-add pull-right add-series">
Add
<icon class="icon-plus"></icon>
</div>
{{#unless path}}
{{> RootFolderSelectionPartial rootFolders}}
{{/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>
{{/if}}
</div>
</div>
</div>