mirror of https://github.com/lidarr/Lidarr
FInished add series. need some error handling but mostly on the server.
This commit is contained in:
parent
27afb2402a
commit
b6a4e6c32c
|
@ -72,9 +72,10 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
|
|
||||||
this.qualityProfileCollection.fetch();
|
this.qualityProfileCollection.fetch();
|
||||||
|
this.rootFolderCollection.fetch();
|
||||||
|
|
||||||
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView({ rootFolders: this.rootFolderCollection, qualityProfiles: this.qualityProfileCollection }));
|
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView({ rootFolders: this.rootFolderCollection, qualityProfiles: this.qualityProfileCollection }));
|
||||||
this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView({ collection: this.rootFolderCollection }));
|
this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView({ collection: this.rootFolderCollection, quality: this.qualityProfileCollection }));
|
||||||
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection }));
|
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection }));
|
||||||
|
|
||||||
this.listenTo(this.rootFolderCollection, 'add', this.evaluateActions, this);
|
this.listenTo(this.rootFolderCollection, 'add', this.evaluateActions, this);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="line row folder-match-result-view">
|
<div class="line row folder-match-result-view">
|
||||||
<a href="http://thetvdb.com/?tab=series&id={{id}}" target="_blank" class="icon-info-sign"></a>
|
<a href="http://thetvdb.com/?tab=series&id={{id}}" target="_blank" class="icon-info-sign"></a>
|
||||||
<span>{{seriesName}} {{seriesYear}}</span>
|
<span>{{seriesName}} {{seriesYear}}</span>
|
||||||
<span class="icon-plus pull-right btn btn-success"></span>
|
<span class="icon-plus pull-right btn btn-success x-btn-add"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,23 +6,58 @@
|
||||||
|
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
|
||||||
template: "AddSeries/Existing/FolderMatchResultViewTemplatate",
|
template: 'AddSeries/Existing/FolderMatchResultViewTemplatate',
|
||||||
|
|
||||||
|
events: {
|
||||||
|
'click .x-btn-add': 'addSeries'
|
||||||
|
},
|
||||||
|
|
||||||
|
addSeries: function () {
|
||||||
|
|
||||||
|
var seriesId = this.model.get('id');
|
||||||
|
var title = this.model.get('seriesName');
|
||||||
|
var quality = this.options.qualityProfile.val();
|
||||||
|
var path = this.options.rootFolder + "\\" + title;
|
||||||
|
|
||||||
|
var model = new NzbDrone.Series.SeriesModel({
|
||||||
|
seriesId: seriesId,
|
||||||
|
title: title,
|
||||||
|
qualityProfileId: quality,
|
||||||
|
path: path
|
||||||
|
});
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
model.save(undefined, {
|
||||||
|
success: function () {
|
||||||
|
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
||||||
|
title: 'Added',
|
||||||
|
message: title,
|
||||||
|
level: 'success'
|
||||||
|
});
|
||||||
|
|
||||||
|
NzbDrone.Shared.NotificationCollectionView.Instance.collection.add(notificationModel);
|
||||||
|
self.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
||||||
|
|
||||||
template: "AddSeries/Existing/UnmappedFolderCompositeViewTemplatate",
|
template: 'AddSeries/Existing/UnmappedFolderCompositeViewTemplatate',
|
||||||
itemViewContainer: ".x-folder-name-match-results",
|
itemViewContainer: '.x-folder-name-match-results',
|
||||||
itemView: NzbDrone.AddSeries.Existing.FolderMatchResultView,
|
itemView: NzbDrone.AddSeries.Existing.FolderMatchResultView,
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .x-search': 'search'
|
'click .x-btn-search': 'search'
|
||||||
},
|
},
|
||||||
|
|
||||||
ui: {
|
ui: {
|
||||||
searchButton: '.x-search'
|
searchButton: '.x-btn-search',
|
||||||
|
searchText: '.x-txt-search',
|
||||||
|
profileList: '.x-lst-quality-profile'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
@ -35,19 +70,29 @@ NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.Co
|
||||||
|
|
||||||
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
|
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
this.collection.fetch({
|
this.collection.fetch({
|
||||||
data: $.param({ term: this.model.get('folder') }),
|
data: $.param({ term: this.ui.searchText.val() }),
|
||||||
success: function () {
|
success: function (model) {
|
||||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||||
|
|
||||||
},
|
},
|
||||||
fail:function() {
|
fail: function () {
|
||||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
itemViewOptions: function () {
|
||||||
|
return {
|
||||||
|
qualityProfile: this.ui.profileList,
|
||||||
|
rootFolder: this.model.get('rootFolder')
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
||||||
|
@ -62,20 +107,48 @@ NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.Compos
|
||||||
throw "model is required.";
|
throw "model is required.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.options.quality) {
|
||||||
|
throw "quality collection is required.";
|
||||||
|
}
|
||||||
|
|
||||||
this.collection = new NzbDrone.AddSeries.Existing.UnmappedFolderCollection();
|
this.collection = new NzbDrone.AddSeries.Existing.UnmappedFolderCollection();
|
||||||
this.collection.importArray(this.model.get('unmappedFolders'));
|
this.refreshItems();
|
||||||
|
this.listenTo(this.options.quality, 'reset', this.refreshItems, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
refreshItems: function () {
|
||||||
|
this.collection.importItems(this.model, this.options.quality);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
|
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
|
||||||
|
|
||||||
itemView: NzbDrone.AddSeries.Existing.RootFolderCompositeView,
|
itemView: NzbDrone.AddSeries.Existing.RootFolderCompositeView,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
|
||||||
if (!this.collection) {
|
if (!this.collection) {
|
||||||
throw "root folder collection is required.";
|
throw "root folder collection is required.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.options.quality) {
|
||||||
|
throw "quality collection is required.";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.itemViewOptions = {
|
||||||
|
quality: this.options.quality
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
<div class="row unmapped-folder-view">
|
<div class="row unmapped-folder-view">
|
||||||
<div class="span11">
|
<div class="span11">
|
||||||
<div class="row folder-header">
|
<div class="row folder-header">
|
||||||
{{folder}}
|
<input class="x-txt-search input-xlarge" type="text" value="{{folder}}" placeholder="{{folder}}"></input>
|
||||||
<div class="btn btn-primary x-search pull-right">
|
<select class="span2 x-lst-quality-profile">
|
||||||
|
{{#each quality.models}}
|
||||||
|
<option value="{{id}}">{{attributes.name}}</option>
|
||||||
|
{{/each}}
|
||||||
|
</select>
|
||||||
|
<div class="btn btn-primary x-btn-search pull-right">
|
||||||
<icon class="icon-search "></icon>
|
<icon class="icon-search "></icon>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,23 @@ NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.exten
|
||||||
model: NzbDrone.AddSeries.Existing.UnmappedFolderModel,
|
model: NzbDrone.AddSeries.Existing.UnmappedFolderModel,
|
||||||
|
|
||||||
|
|
||||||
importArray: function (unmappedFolderArray) {
|
importItems: function (rootFolderModel, quality) {
|
||||||
|
|
||||||
if (!unmappedFolderArray) {
|
if (!rootFolderModel) {
|
||||||
throw "folder array is required";
|
throw "folder array is required";
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(unmappedFolderArray, function (folder) {
|
if (!quality) {
|
||||||
this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({ folder: folder }));
|
throw "quality is required";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.reset();
|
||||||
|
|
||||||
|
var qualityCollection = quality;
|
||||||
|
var rootFolder = rootFolderModel.get('path');
|
||||||
|
|
||||||
|
_.each(rootFolderModel.get('unmappedFolders'), function (folder) {
|
||||||
|
this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({rootFolder:rootFolder, folder: folder, quality: qualityCollection }));
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -62,10 +62,18 @@
|
||||||
|
|
||||||
.unmapped-folder-view .folder-header {
|
.unmapped-folder-view .folder-header {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight:300
|
font-weight: 300;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unmapped-folder-view .folder-header input {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unmapped-folder-view .folder-header select {
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.existing-root-folder-view, h1 {
|
.existing-root-folder-view, h1 {
|
||||||
padding: 10px 0px 20px 0px;
|
padding: 10px 0px 20px 0px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue