2013-01-18 22:05:52 +00:00
NzbDrone . AddSeriesView = Backbone . Marionette . ItemView . extend ( {
2013-01-19 01:27:30 +00:00
template : "#add-series" ,
events : {
'click #add-new' : 'addNew' ,
'click #add-existing' : 'addExisting'
} ,
addNew : function ( ) {
NzbDrone . Router . navigate ( NzbDrone . Routes . Series . AddNew , { trigger : true } ) ;
} ,
addExisting : function ( ) {
NzbDrone . Router . navigate ( NzbDrone . Routes . Series . AddExisting , { trigger : true } ) ;
}
2013-01-18 22:16:24 +00:00
} ) ;
NzbDrone . AddNewSeriesView = Backbone . Marionette . ItemView . extend ( {
2013-01-19 01:27:30 +00:00
template : "#add-new-series" ,
ui : {
seriesSearch : '#series-search'
} ,
onRender : function ( ) {
console . log ( 'binding auto complete' )
var self = this ;
this . ui . seriesSearch
. autocomplete ( {
source : "http://kayone.nzbdrone.com:8989/AddSeries/LookupSeries" ,
minLength : 1 ,
delay : 500 ,
select : function ( event , ui ) {
$ ( this ) . val ( ui . item . Title ) ;
$ ( this ) . siblings ( '.seriesId' ) . val ( ui . item . Id ) ;
return false ;
} ,
open : function ( event , ui ) {
$ ( '.ui-autocomplete' ) . addClass ( 'seriesLookupResults' ) ;
} ,
close : function ( event , ui ) {
$ ( '.ui-autocomplete' ) . removeClass ( 'seriesLookupResults' ) ;
}
} )
. data ( "autocomplete" ) . _renderItem = function ( ul , item ) {
return $ ( "<li></li>" )
. data ( "item.autocomplete" , item )
. append ( "<a>" + item . DisplayedTitle + "<img src='../../Content/Images/thetvdb.png' class='tvDbLink' title='Click to see series details from TheTVDB' rel='" + item . Url + "' /></a>" )
. appendTo ( ul ) ;
} ;
} ,
2013-01-18 22:16:24 +00:00
} ) ;
NzbDrone . AddExistingSeriesView = Backbone . Marionette . ItemView . extend ( {
2013-01-19 01:27:30 +00:00
template : "#add-existing-series" ,
events : {
'click #single' : 'single' ,
'click #multiple' : 'multiple'
} ,
single : function ( ) {
NzbDrone . Router . navigate ( NzbDrone . Routes . Series . AddExistingSingle , { trigger : true } ) ;
} ,
multiple : function ( ) {
NzbDrone . Router . navigate ( NzbDrone . Routes . Series . AddExistingMultiple , { trigger : true } ) ;
}
} ) ;
NzbDrone . AddExistingSeriesSingleView = Backbone . Marionette . ItemView . extend ( {
template : "#add-existing-series-single"
} ) ;
NzbDrone . AddExistingSeriesMultipleView = Backbone . Marionette . ItemView . extend ( {
template : "#add-existing-series-multiple"
} )