much nicer add new series.

This commit is contained in:
kay.one 2013-03-31 14:45:16 -07:00
commit 4be637edff
16 changed files with 87 additions and 87 deletions

View file

@ -12,7 +12,7 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/Sear
searchResult: '#search-result'
},
collection: new NzbDrone.AddSeries.SearchResultCollection(),
collection: new NzbDrone.Series.SeriesCollection(),
onRender: function () {
console.log('binding auto complete');
@ -25,6 +25,7 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/Sear
self.$el.data('timeout', window.setTimeout(self.search, 500, self));
});
this.collection.url = NzbDrone.Constants.ApiRoot + '/series/lookup';
this.resultView = new NzbDrone.AddSeries.SearchResultView({ collection: this.collection });
},

View file

@ -1,11 +1,13 @@
<div class="accordion-group">
<div class="accordion-heading">
<a href="http://thetvdb.com/?tab=series&id={{tvDbId}}" target="_blank" class="icon-info-sign pull-left"></a>
<a class="accordion-toggle" data-toggle="collapse" href="#{{tvDbId}}">{{title}} {{seriesYear}}</a>
<div class="row">
<div class="span2">
<a href="{{traktUrl}}" target="_blank">
<img class="series-poster img-polaroid" src="{{banner}}">
</a>
</div>
<div id="{{tvDbId}}" class="accordion-body collapse">
<div class="accordion-inner">
<select class="span7 x-root-folder">
<div class="span9">
<div class="row">
<select class="span6 x-root-folder">
{{#each rootFolders.models}}
<option value="{{id}}">{{attributes.path}}</option>
{{/each}}
@ -16,8 +18,13 @@
{{/each}}
</select>
<div class="btn btn-success pull-right icon-plus x-add">
</div>
<div class="btn btn-success icon-plus x-add pull-right"/>
</div>
<div class="row">
<h2>{{title}}</h2>
</div>
<div class="row">
{{overview}}
</div>
</div>
</div>

View file

@ -22,32 +22,22 @@ define(['app', 'Shared/NotificationCollection', 'AddSeries/SearchResultCollectio
add: function () {
var seriesId = this.model.get('tvDbId');
var title = this.model.get('title');
var quality = this.ui.qualityProfile.val();
var rootFolderId = this.ui.rootFolder.val();
//Todo: This will create an invalid path on linux...
var rootPath = this.model.get('rootFolders').get(rootFolderId).get('path');
var path = rootPath + "\\" + title;
var rootPath = this.ui.rootFolder.find(":selected").text();
var path = rootPath + "\\" + this.model.get('title');
var model = new NzbDrone.Series.SeriesModel({
tvdbId : seriesId,
title : title,
qualityProfileId: quality,
path : path
});
this.model.set('qualityProfileId', quality);
this.model.set('path', path);
var self = this;
var seriesCollection = new NzbDrone.Series.SeriesCollection();
seriesCollection.push(model);
model.save(undefined, {
this.model.save(undefined, {
success: function () {
var notificationModel = new NzbDrone.Shared.NotificationModel({
title : 'Added',
message: title,
message: self.model.get('title'),
level : 'success'
});