@ -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/SearchResult Template',
template : 'AddSeries/SearchResult View Template',
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' ) ;