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

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