parent
8ba29fde94
commit
c01f982698
|
@ -6,12 +6,10 @@ using AutoMapper;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using Nancy;
|
using Nancy;
|
||||||
using NzbDrone.Api.Extentions;
|
using NzbDrone.Api.Extentions;
|
||||||
using NzbDrone.Api.QualityProfiles;
|
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Core.Jobs;
|
using NzbDrone.Core.Jobs;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
|
||||||
|
|
||||||
namespace NzbDrone.Api.Series
|
namespace NzbDrone.Api.Series
|
||||||
{
|
{
|
||||||
|
@ -30,8 +28,7 @@ namespace NzbDrone.Api.Series
|
||||||
Post["/"] = x => AddSeries();
|
Post["/"] = x => AddSeries();
|
||||||
Put["/"] = x => UpdateSeries();
|
Put["/"] = x => UpdateSeries();
|
||||||
|
|
||||||
//Todo: Backbone failing and not sending the id properly... wtf
|
Delete["/{id}"] = x => DeleteSeries((int)x.id);
|
||||||
Delete["/"] = x => DeleteSeries(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Response AllSeries()
|
private Response AllSeries()
|
||||||
|
@ -98,10 +95,8 @@ namespace NzbDrone.Api.Series
|
||||||
|
|
||||||
private Response DeleteSeries(int id)
|
private Response DeleteSeries(int id)
|
||||||
{
|
{
|
||||||
var seriesId = Convert.ToInt32(Request.Headers["id"].FirstOrDefault());
|
|
||||||
var deleteFiles = Convert.ToBoolean(Request.Headers["deleteFiles"].FirstOrDefault());
|
var deleteFiles = Convert.ToBoolean(Request.Headers["deleteFiles"].FirstOrDefault());
|
||||||
|
_jobProvider.QueueJob(typeof(DeleteSeriesJob), new { SeriesId = id, DeleteFiles = deleteFiles });
|
||||||
_jobProvider.QueueJob(typeof(DeleteSeriesJob), new {SeriesId = seriesId, DeleteFiles = deleteFiles});
|
|
||||||
return new Response { StatusCode = HttpStatusCode.OK };
|
return new Response { StatusCode = HttpStatusCode.OK };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,6 +211,7 @@
|
||||||
<Content Include="_backboneApp\AddSeries\RootFolders\RootFolderCollection.js" />
|
<Content Include="_backboneApp\AddSeries\RootFolders\RootFolderCollection.js" />
|
||||||
<Content Include="_backboneApp\Content\jquery.dataTables.bootstrap.css" />
|
<Content Include="_backboneApp\Content\jquery.dataTables.bootstrap.css" />
|
||||||
<Content Include="_backboneApp\JsLibraries\jquery.js" />
|
<Content Include="_backboneApp\JsLibraries\jquery.js" />
|
||||||
|
<Content Include="_backboneApp\JsLibraries\require.js" />
|
||||||
<Content Include="_backboneApp\Routing.js" />
|
<Content Include="_backboneApp\Routing.js" />
|
||||||
<Content Include="_backboneApp\JsLibraries\backbone.modelbinder.js" />
|
<Content Include="_backboneApp\JsLibraries\backbone.modelbinder.js" />
|
||||||
<Content Include="_backboneApp\AddSeries\New\AddNewSeriesTemplate.html" />
|
<Content Include="_backboneApp\AddSeries\New\AddNewSeriesTemplate.html" />
|
||||||
|
@ -222,7 +223,6 @@
|
||||||
<Content Include="_backboneApp\JsLibraries\jquery.dataTables.extensions.js" />
|
<Content Include="_backboneApp\JsLibraries\jquery.dataTables.extensions.js" />
|
||||||
<Content Include="_backboneApp\JsLibraries\jquery.dataTables.js" />
|
<Content Include="_backboneApp\JsLibraries\jquery.dataTables.js" />
|
||||||
<Content Include="_backboneApp\JsLibraries\jquery.dataTables.bootstrap.pagination.js" />
|
<Content Include="_backboneApp\JsLibraries\jquery.dataTables.bootstrap.pagination.js" />
|
||||||
<Content Include="_backboneApp\JsLibraries\require-jquery.js" />
|
|
||||||
<Content Include="_backboneApp\Quality\qualityProfileModel.js" />
|
<Content Include="_backboneApp\Quality\qualityProfileModel.js" />
|
||||||
<Content Include="_backboneApp\Quality\qualityProfileCollection.js" />
|
<Content Include="_backboneApp\Quality\qualityProfileCollection.js" />
|
||||||
<Content Include="_backboneApp\Quality\qualityTypeModel.js" />
|
<Content Include="_backboneApp\Quality\qualityTypeModel.js" />
|
||||||
|
|
|
@ -63,7 +63,19 @@
|
||||||
<div id="footer-region" class="span20"></div>
|
<div id="footer-region" class="span20"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script data-main="/_backboneApp/app" src="/_backboneApp/JsLibraries/require-jquery.js"></script>
|
<script src="../../_backboneApp/JsLibraries/jquery.js"></script>
|
||||||
|
<script src="../../_backboneApp/JsLibraries/bootstrap.js"></script>
|
||||||
|
<script src="../../_backboneApp/JsLibraries/underscore.js"></script>
|
||||||
|
<script src="../../_backboneApp/JsLibraries/handlebars.js"></script>
|
||||||
|
<script src="../../_backboneApp/JsLibraries/backbone.js"></script>
|
||||||
|
<script src="../../_backboneApp/JsLibraries/backbone.modelbinder.js"></script>
|
||||||
|
<script src="../../_backboneApp/JsLibraries/backbone.mutators.js"></script>
|
||||||
|
<script src="../../_backboneApp/JsLibraries/backbone.marionette.js"></script>
|
||||||
|
<script src="../../_backboneApp/JsLibraries/jquery.dataTables.js"></script>
|
||||||
|
<script src="../../_backboneApp/JsLibraries/jquery.dataTables.extensions.js"></script>
|
||||||
|
<script src="../../_backboneApp/JsLibraries/jquery.dataTables.bootstrap.pagination.js"></script>
|
||||||
|
|
||||||
|
<script data-main="/_backboneApp/app" src="/_backboneApp/JsLibraries/require.js"></script>
|
||||||
<script src="/_backboneApp/Routing.js"></script>
|
<script src="/_backboneApp/Routing.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectCodeStyleSettingsManager">
|
<component name="ProjectCodeStyleSettingsManager">
|
||||||
<option name="PER_PROJECT_SETTINGS">
|
<option name="PER_PROJECT_SETTINGS">
|
||||||
<value />
|
<value>
|
||||||
|
<XML>
|
||||||
|
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||||
|
</XML>
|
||||||
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
<component name="ProjectDictionaryState">
|
<component name="ProjectDictionaryState">
|
||||||
<dictionary name="Keivan" />
|
<dictionary name="Keivan">
|
||||||
|
<words>
|
||||||
|
<w>mutators</w>
|
||||||
|
</words>
|
||||||
|
</dictionary>
|
||||||
</component>
|
</component>
|
|
@ -1,12 +1,12 @@
|
||||||
define([
|
define([
|
||||||
'app',
|
'app',
|
||||||
'AddSeries/RootFolders/RootFolderCollection',
|
'AddSeries/RootFolders/RootFolderCollection',
|
||||||
|
'Quality/QualityProfileCollection',
|
||||||
'AddSeries/RootFolders/RootFolderView',
|
'AddSeries/RootFolders/RootFolderView',
|
||||||
'AddSeries/New/AddNewSeriesView',
|
'AddSeries/New/AddNewSeriesView',
|
||||||
'AddSeries/Existing/ImportSeriesView',
|
'AddSeries/Existing/ImportSeriesView'
|
||||||
'Quality/QualityProfileCollection'
|
|
||||||
],
|
],
|
||||||
function (app, rootFolderCollection) {
|
function (app, rootFolderCollection, qualityProfileCollection) {
|
||||||
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
|
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
|
||||||
template: 'AddSeries/addSeriesLayoutTemplate',
|
template: 'AddSeries/addSeriesLayoutTemplate',
|
||||||
|
|
||||||
|
@ -55,8 +55,6 @@
|
||||||
NzbDrone.Router.navigate('series/add/rootfolders');
|
NzbDrone.Router.navigate('series/add/rootfolders');
|
||||||
},
|
},
|
||||||
|
|
||||||
//rootFolderCollection: new NzbDrone.AddSeries.RootFolders.RootFolderCollection(),
|
|
||||||
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
|
||||||
|
|
||||||
initialize: function (context, action, query) {
|
initialize: function (context, action, query) {
|
||||||
if (action) {
|
if (action) {
|
||||||
|
@ -71,10 +69,11 @@
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
|
|
||||||
rootFolderCollection.fetch();
|
rootFolderCollection.fetch();
|
||||||
|
qualityProfileCollection.fetch();
|
||||||
|
|
||||||
this.addNew.show(new NzbDrone.AddSeries.New.AddNewSeriesView({ qualityProfiles: this.qualityProfileCollection }));
|
this.addNew.show(new NzbDrone.AddSeries.New.AddNewSeriesView());
|
||||||
this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView({ quality: this.qualityProfileCollection }));
|
this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView());
|
||||||
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection }));
|
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView());
|
||||||
|
|
||||||
this.listenTo(rootFolderCollection, 'add', this.evaluateActions, this);
|
this.listenTo(rootFolderCollection, 'add', this.evaluateActions, this);
|
||||||
this.listenTo(rootFolderCollection, 'remove', this.evaluateActions, this);
|
this.listenTo(rootFolderCollection, 'remove', this.evaluateActions, this);
|
||||||
|
@ -103,7 +102,7 @@
|
||||||
this.ui.addNewTab.show();
|
this.ui.addNewTab.show();
|
||||||
this.ui.importExistingTab.show();
|
this.ui.importExistingTab.show();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,145 +1,139 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/Existing/UnmappedFolderModel', 'AddSeries/SearchResultCollection', 'Series/SeriesModel'], function (app,rootFolders) {
|
define([
|
||||||
|
'app',
|
||||||
|
'AddSeries/RootFolders/RootFolderCollection',
|
||||||
|
'Quality/QualityProfileCollection',
|
||||||
|
'Shared/NotificationCollection',
|
||||||
|
'AddSeries/Existing/UnmappedFolderModel',
|
||||||
|
'AddSeries/SearchResultCollection',
|
||||||
|
'Series/SeriesModel'],
|
||||||
|
function (app, rootFolders, qualityProfileCollection, notificationCollection) {
|
||||||
|
|
||||||
|
|
||||||
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: {
|
events:{
|
||||||
'click .x-btn-add': 'addSeries'
|
'click .x-btn-add':'addSeries'
|
||||||
},
|
},
|
||||||
|
|
||||||
addSeries: function () {
|
addSeries:function () {
|
||||||
|
|
||||||
var seriesId = this.model.get('id');
|
var seriesId = this.model.get('id');
|
||||||
var title = this.model.get('seriesName');
|
var title = this.model.get('seriesName');
|
||||||
var quality = this.options.qualityProfile.val();
|
var quality = this.options.qualityProfile.val();
|
||||||
var path = this.options.rootFolder + "\\" + title;
|
var path = this.options.rootFolder + "\\" + title;
|
||||||
|
|
||||||
var model = new NzbDrone.Series.SeriesModel({
|
var model = new NzbDrone.Series.SeriesModel({
|
||||||
seriesId: seriesId,
|
seriesId:seriesId,
|
||||||
title: title,
|
title:title,
|
||||||
qualityProfileId: quality,
|
qualityProfileId:quality,
|
||||||
path: path
|
path:path
|
||||||
});
|
});
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
model.save(undefined, {
|
model.save(undefined, {
|
||||||
success: function () {
|
success:function () {
|
||||||
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
||||||
title: 'Added',
|
title:'Added',
|
||||||
message: title,
|
message:title,
|
||||||
level: 'success'
|
level:'success'
|
||||||
});
|
});
|
||||||
|
|
||||||
NzbDrone.Shared.NotificationCollectionView.Instance.collection.add(notificationModel);
|
notificationCollection.push(notificationModel);
|
||||||
self.close();
|
self.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
||||||
|
|
||||||
|
template:'AddSeries/Existing/UnmappedFolderCompositeViewTemplatate',
|
||||||
|
itemViewContainer:'.x-folder-name-match-results',
|
||||||
|
itemView:NzbDrone.AddSeries.Existing.FolderMatchResultView,
|
||||||
|
|
||||||
|
events:{
|
||||||
|
'click .x-btn-search':'search'
|
||||||
|
},
|
||||||
|
|
||||||
|
ui:{
|
||||||
|
searchButton:'.x-btn-search',
|
||||||
|
searchText:'.x-txt-search',
|
||||||
|
profileList:'.x-lst-quality-profile'
|
||||||
|
},
|
||||||
|
|
||||||
|
initialize:function () {
|
||||||
|
this.collection = new NzbDrone.AddSeries.SearchResultCollection();
|
||||||
|
},
|
||||||
|
|
||||||
|
search:function () {
|
||||||
|
|
||||||
|
var icon = this.ui.searchButton.find('icon');
|
||||||
|
|
||||||
|
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
this.collection.fetch({
|
||||||
|
data:$.param({ term:this.ui.searchText.val() }),
|
||||||
|
success:function (model) {
|
||||||
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||||
|
|
||||||
|
},
|
||||||
|
fail:function () {
|
||||||
|
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({
|
||||||
|
|
||||||
|
template:"AddSeries/Existing/RootFolderCompositeViewTemplate",
|
||||||
|
itemViewContainer:".x-existing-folder-container",
|
||||||
|
itemView:NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView,
|
||||||
|
|
||||||
|
initialize:function () {
|
||||||
|
|
||||||
|
if (!this.model) {
|
||||||
|
throw "model is required.";
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
this.collection = new NzbDrone.AddSeries.Existing.UnmappedFolderCollection();
|
||||||
|
this.refreshItems();
|
||||||
|
this.listenTo(qualityProfileCollection, 'reset', this.refreshItems, this);
|
||||||
|
},
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
refreshItems:function () {
|
||||||
|
this.collection.importItems(this.model, qualityProfileCollection);
|
||||||
|
|
||||||
template: 'AddSeries/Existing/UnmappedFolderCompositeViewTemplatate',
|
|
||||||
itemViewContainer: '.x-folder-name-match-results',
|
|
||||||
itemView: NzbDrone.AddSeries.Existing.FolderMatchResultView,
|
|
||||||
|
|
||||||
events: {
|
|
||||||
'click .x-btn-search': 'search'
|
|
||||||
},
|
|
||||||
|
|
||||||
ui: {
|
|
||||||
searchButton: '.x-btn-search',
|
|
||||||
searchText: '.x-txt-search',
|
|
||||||
profileList: '.x-lst-quality-profile'
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function () {
|
|
||||||
this.collection = new NzbDrone.AddSeries.SearchResultCollection();
|
|
||||||
},
|
|
||||||
|
|
||||||
search: function () {
|
|
||||||
|
|
||||||
var icon = this.ui.searchButton.find('icon');
|
|
||||||
|
|
||||||
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
|
|
||||||
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
this.collection.fetch({
|
|
||||||
data: $.param({ term: this.ui.searchText.val() }),
|
|
||||||
success: function (model) {
|
|
||||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
|
||||||
|
|
||||||
},
|
|
||||||
fail: function () {
|
|
||||||
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({
|
|
||||||
|
|
||||||
template: "AddSeries/Existing/RootFolderCompositeViewTemplate",
|
|
||||||
itemViewContainer: ".x-existing-folder-container",
|
|
||||||
itemView: NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView,
|
|
||||||
|
|
||||||
initialize: function () {
|
|
||||||
|
|
||||||
if (!this.model) {
|
|
||||||
throw "model is required.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.options.quality) {
|
|
||||||
throw "quality collection is required.";
|
|
||||||
|
});
|
||||||
|
|
||||||
|
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
|
||||||
|
|
||||||
|
itemView:NzbDrone.AddSeries.Existing.RootFolderCompositeView,
|
||||||
|
|
||||||
|
initialize:function () {
|
||||||
|
this.collection = rootFolders;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.collection = new NzbDrone.AddSeries.Existing.UnmappedFolderCollection();
|
});
|
||||||
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({
|
|
||||||
|
|
||||||
itemView: NzbDrone.AddSeries.Existing.RootFolderCompositeView,
|
|
||||||
|
|
||||||
initialize: function () {
|
|
||||||
|
|
||||||
this.collection = rootFolders;
|
|
||||||
|
|
||||||
if (!this.options.quality) {
|
|
||||||
throw "quality collection is required.";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.itemViewOptions = {
|
|
||||||
quality: this.options.quality
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
define(['app'], function () {
|
define(['app','Quality/QualityProfileCollection'], function (app, qualityProfiles) {
|
||||||
|
|
||||||
|
|
||||||
NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({
|
NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({
|
||||||
|
|
||||||
|
defaults :{
|
||||||
|
quality: qualityProfiles
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -12,23 +15,14 @@ define(['app'], function () {
|
||||||
model: NzbDrone.AddSeries.Existing.UnmappedFolderModel,
|
model: NzbDrone.AddSeries.Existing.UnmappedFolderModel,
|
||||||
|
|
||||||
|
|
||||||
importItems: function (rootFolderModel, quality) {
|
|
||||||
|
|
||||||
if (!rootFolderModel) {
|
importItems: function (rootFolderModel) {
|
||||||
throw "folder array is required";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!quality) {
|
|
||||||
throw "quality is required";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
var qualityCollection = quality;
|
|
||||||
var rootFolder = rootFolderModel.get('path');
|
var rootFolder = rootFolderModel.get('path');
|
||||||
|
|
||||||
_.each(rootFolderModel.get('unmappedFolders'), function (folder) {
|
_.each(rootFolderModel.get('unmappedFolders'), function (folder) {
|
||||||
this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({ rootFolder: rootFolder, folder: folder, quality: qualityCollection }));
|
this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({ rootFolder: rootFolder, folder: folder}));
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,20 +9,11 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
regions: {
|
regions: {
|
||||||
searchResult: '#search-result',
|
searchResult: '#search-result'
|
||||||
},
|
},
|
||||||
|
|
||||||
collection: new NzbDrone.AddSeries.SearchResultCollection(),
|
collection: new NzbDrone.AddSeries.SearchResultCollection(),
|
||||||
|
|
||||||
initialize: function (options) {
|
|
||||||
|
|
||||||
if (options.qualityProfiles === undefined) {
|
|
||||||
throw 'qualityProfiles arg. is required.';
|
|
||||||
}
|
|
||||||
|
|
||||||
this.qualityProfileCollection = options.qualityProfiles;
|
|
||||||
},
|
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
console.log('binding auto complete');
|
console.log('binding auto complete');
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -48,9 +39,9 @@
|
||||||
context.searchResult.show(new NzbDrone.Shared.SpinnerView());
|
context.searchResult.show(new NzbDrone.Shared.SpinnerView());
|
||||||
|
|
||||||
context.currentSearchRequest = context.collection.fetch({
|
context.currentSearchRequest = context.collection.fetch({
|
||||||
data: $.param({ term: term }),
|
data: { term: term },
|
||||||
success: function (model) {
|
success: function (model) {
|
||||||
context.resultUpdated(model, context);
|
context.searchResult.show(context.resultView);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -64,16 +55,6 @@
|
||||||
console.log('aborting previous pending search request.');
|
console.log('aborting previous pending search request.');
|
||||||
this.currentSearchRequest.abort();
|
this.currentSearchRequest.abort();
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
resultUpdated: function (options, context) {
|
|
||||||
_.each(options.models, function (model) {
|
|
||||||
model.set('rootFolders', rootFolders);
|
|
||||||
model.set('qualityProfiles', context.qualityProfileCollection);
|
|
||||||
});
|
|
||||||
|
|
||||||
context.searchResult.show(context.resultView);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
var rootFolderCollection = Backbone.Collection.extend({
|
var rootFolderCollection = Backbone.Collection.extend({
|
||||||
url: NzbDrone.Constants.ApiRoot + '/rootdir',
|
url: NzbDrone.Constants.ApiRoot + '/rootdir',
|
||||||
model: NzbDrone.AddSeries.RootFolders.RootFolderModel,
|
model: NzbDrone.AddSeries.RootFolders.RootFolderModel
|
||||||
});
|
});
|
||||||
|
|
||||||
return new rootFolderCollection();
|
return new rootFolderCollection();
|
||||||
|
|
|
@ -9,7 +9,7 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Shared/AutoComplet
|
||||||
tagName: 'tr',
|
tagName: 'tr',
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .x-remove': 'removeFolder',
|
'click .x-remove': 'removeFolder'
|
||||||
},
|
},
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
|
@ -19,7 +19,7 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Shared/AutoComplet
|
||||||
removeFolder: function () {
|
removeFolder: function () {
|
||||||
this.model.destroy({ wait: true });
|
this.model.destroy({ wait: true });
|
||||||
this.model.collection.remove(this.model);
|
this.model.collection.remove(this.model);
|
||||||
},
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection'], function (RootFolderCollection) {
|
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection'],
|
||||||
|
function (app, rootFolderCollection, qualityProfileCollection) {
|
||||||
|
|
||||||
NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({
|
NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({
|
||||||
mutators: {
|
mutators: {
|
||||||
|
@ -16,8 +16,8 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
defaults: {
|
defaults: {
|
||||||
qualityProfiles: new NzbDrone.Quality.QualityProfileCollection(),
|
qualityProfiles: qualityProfileCollection,
|
||||||
rootFolders: RootFolderCollection
|
rootFolders: rootFolderCollection
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1382,6 +1382,7 @@
|
||||||
Backbone.sync = function (method, model, options) {
|
Backbone.sync = function (method, model, options) {
|
||||||
var type = methodMap[method];
|
var type = methodMap[method];
|
||||||
|
|
||||||
|
|
||||||
// Default options, unless specified.
|
// Default options, unless specified.
|
||||||
_.defaults(options || (options = {}), {
|
_.defaults(options || (options = {}), {
|
||||||
emulateHTTP: Backbone.emulateHTTP,
|
emulateHTTP: Backbone.emulateHTTP,
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/// <reference path="jquery.dataTables-1.10.0-dev.js" />
|
|
||||||
/// <reference path="jquery.dataTables.extensions.js" />
|
|
||||||
|
|
||||||
/* Default class modification */
|
/* Default class modification */
|
||||||
$.extend($.fn.dataTableExt.oStdClasses, {
|
$.extend($.fn.dataTableExt.oStdClasses, {
|
||||||
"sWrapper": "dataTables_wrapper form-horizontal"
|
"sWrapper": "dataTables_wrapper form-horizontal"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,13 @@
|
||||||
define(['app', 'Quality/QualityProfileModel'], function () {
|
define(['app', 'Quality/QualityProfileModel'], function () {
|
||||||
|
|
||||||
NzbDrone.Quality.QualityProfileCollection = Backbone.Collection.extend({
|
var qualityProfileCollection = Backbone.Collection.extend({
|
||||||
model: NzbDrone.Quality.QualityProfileModel,
|
model:NzbDrone.Quality.QualityProfileModel,
|
||||||
url: NzbDrone.Constants.ApiRoot + '/qualityprofiles'
|
url:NzbDrone.Constants.ApiRoot + '/qualityprofiles'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var profiles = new qualityProfileCollection();
|
||||||
|
|
||||||
|
profiles.fetch();
|
||||||
|
|
||||||
|
return profiles;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require(['app','Shared/NotificationView', 'AddSeries/AddSeriesLayout','Series/SeriesLayout'], function () {
|
require(['app','Shared/NotificationView', 'AddSeries/AddSeriesLayout','Series/SeriesCollectionView'], function () {
|
||||||
|
|
||||||
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
|
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
series: function (action, query) {
|
series: function (action, query) {
|
||||||
NzbDrone.mainRegion.show(new NzbDrone.Series.SeriesLayout(this, action, query));
|
NzbDrone.mainRegion.show(new NzbDrone.Series.SeriesCollectionView(this, action, query));
|
||||||
},
|
},
|
||||||
|
|
||||||
notFound: function () {
|
notFound: function () {
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
controller: new NzbDrone.Controller(),
|
controller: new NzbDrone.Controller(),
|
||||||
appRoutes: {
|
appRoutes: {
|
||||||
|
'': 'series',
|
||||||
'series': 'series',
|
'series': 'series',
|
||||||
'series/index': 'series',
|
'series/index': 'series',
|
||||||
'series/add': 'addSeries',
|
'series/add': 'addSeries',
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<p>Are you sure you want to delete '{{title}}'?</p>
|
<p>Are you sure you want to delete '{{title}}'?</p>
|
||||||
<div class="series-delete-files">
|
<div class="series-delete-files">
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input id="delete-from-disk" type="checkbox" value="true">
|
<input class="x-delete-files" type="checkbox" value="true">
|
||||||
Delete all files from disk?
|
Delete all files from disk?
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,27 +3,35 @@
|
||||||
define(['app', 'Series/SeriesModel'], function () {
|
define(['app', 'Series/SeriesModel'], function () {
|
||||||
|
|
||||||
NzbDrone.Series.DeleteSeriesView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.Series.DeleteSeriesView = Backbone.Marionette.ItemView.extend({
|
||||||
template: 'Series/Delete/DeleteSeriesTemplate',
|
template:'Series/Delete/DeleteSeriesTemplate',
|
||||||
tagName: 'div',
|
tagName:'div',
|
||||||
className: "modal",
|
className:"modal",
|
||||||
|
|
||||||
ui: {
|
events:{
|
||||||
'progressbar': '.progress .bar',
|
'click .x-confirm-delete':'removeSeries'
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
ui:{
|
||||||
'click .x-confirm-delete': 'removeSeries',
|
deleteFiles:'.x-delete-files'
|
||||||
},
|
},
|
||||||
|
|
||||||
onRender: function () {
|
onRender:function () {
|
||||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeSeries: function () {
|
removeSeries:function () {
|
||||||
//Todo: why the fuck doesn't destroy send the ID?
|
|
||||||
this.model.destroy({ wait: true, headers: { id: this.model.get('id'), deleteFiles: $('#delete-from-disk').prop('checked') } });
|
var deleteFiles = this.ui.deleteFiles.prop('checked');
|
||||||
this.model.collection.remove(this.model);
|
|
||||||
this.$el.parent().modal('hide');
|
this.model.destroy({
|
||||||
},
|
data:{ 'deleteFiles':deleteFiles },
|
||||||
|
success:function (model) {
|
||||||
|
model.collection.remove(model);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
NzbDrone.modalRegion.close();
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -17,16 +17,10 @@ define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/
|
||||||
'click .x-remove': 'removeSeries'
|
'click .x-remove': 'removeSeries'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
|
||||||
this.qualityProfileCollection = options.qualityProfiles;
|
|
||||||
this.model.set('qualityProfiles', this.qualityProfileCollection);
|
|
||||||
},
|
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||||
},
|
},
|
||||||
|
|
||||||
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
|
||||||
|
|
||||||
saveSeries: function () {
|
saveSeries: function () {
|
||||||
//Todo: Get qualityProfile + backlog setting from UI
|
//Todo: Get qualityProfile + backlog setting from UI
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
define(['app', 'Series/SeriesModel'], function () {
|
define(['app', 'Series/SeriesModel'], function () {
|
||||||
NzbDrone.Series.SeriesCollection = Backbone.Collection.extend({
|
NzbDrone.Series.SeriesCollection = Backbone.Collection.extend({
|
||||||
url: NzbDrone.Constants.ApiRoot + '/series',
|
url: NzbDrone.Constants.ApiRoot + '/series',
|
||||||
model: NzbDrone.Series.SeriesModel,
|
model: NzbDrone.Series.SeriesModel
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -1,21 +1,24 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
define(['app', 'Series/SeriesItemView', 'Quality/QualityProfileCollection','datatables'], function () {
|
define(['app', 'Quality/QualityProfileCollection', 'Series/SeriesItemView'], function (app, qualityProfileCollection) {
|
||||||
NzbDrone.Series.SeriesCollectionView = Backbone.Marionette.CompositeView.extend({
|
NzbDrone.Series.SeriesCollectionView = Backbone.Marionette.CompositeView.extend({
|
||||||
itemView: NzbDrone.Series.SeriesItemView,
|
itemView: NzbDrone.Series.SeriesItemView,
|
||||||
itemViewOptions: {},
|
itemViewOptions: {},
|
||||||
template: 'Series/SeriesCollectionTemplate',
|
template: 'Series/SeriesCollectionTemplate',
|
||||||
tagName: 'table',
|
tagName: 'table',
|
||||||
className: 'table table-hover',
|
className: 'table table-hover',
|
||||||
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
qualityProfileCollection: qualityProfileCollection,
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
this.collection = new NzbDrone.Series.SeriesCollection();
|
||||||
|
this.collection.fetch();
|
||||||
this.qualityProfileCollection.fetch();
|
this.qualityProfileCollection.fetch();
|
||||||
|
|
||||||
this.itemViewOptions = { qualityProfiles: this.qualityProfileCollection };
|
this.itemViewOptions = { qualityProfiles: this.qualityProfileCollection };
|
||||||
},
|
},
|
||||||
|
|
||||||
onRender: function () {
|
onShow: function () {
|
||||||
$('.table').dataTable({
|
this.$el.dataTable({
|
||||||
sDom: "<'row'<'span14'l><'span6'f>r>t<'row'<'span14'i><'span6'p>>",
|
sDom: "<'row'<'span14'l><'span6'f>r>t<'row'<'span14'i><'span6'p>>",
|
||||||
sPaginationType: "bootstrap",
|
sPaginationType: "bootstrap",
|
||||||
bLengthChange: false,
|
bLengthChange: false,
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'app',
|
'app',
|
||||||
|
'Quality/QualityProfileCollection',
|
||||||
'Series/SeriesCollection',
|
'Series/SeriesCollection',
|
||||||
'Series/Edit/EditSeriesView',
|
'Series/Edit/EditSeriesView',
|
||||||
'Series/Delete/DeleteSeriesView',
|
'Series/Delete/DeleteSeriesView'
|
||||||
'Quality/QualityProfileCollection'
|
|
||||||
], function () {
|
], function (app, qualityProfileCollection) {
|
||||||
|
|
||||||
NzbDrone.Series.SeriesItemView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.Series.SeriesItemView = Backbone.Marionette.ItemView.extend({
|
||||||
template: 'Series/SeriesItemTemplate',
|
template: 'Series/SeriesItemTemplate',
|
||||||
|
@ -29,10 +30,9 @@ define([
|
||||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||||
},
|
},
|
||||||
|
|
||||||
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
|
||||||
|
|
||||||
editSeries: function () {
|
editSeries: function () {
|
||||||
var view = new NzbDrone.Series.EditSeriesView({ model: this.model, qualityProfiles: this.qualityProfileCollection });
|
var view = new NzbDrone.Series.EditSeriesView({ model: this.model});
|
||||||
view.on('saved', this.render, this);
|
view.on('saved', this.render, this);
|
||||||
NzbDrone.modalRegion.show(view);
|
NzbDrone.modalRegion.show(view);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
'use strict;'
|
|
||||||
define(['app', 'Series/SeriesCollection', 'Series/SeriesCollectionView', 'bootstrap'], function () {
|
|
||||||
|
|
||||||
|
|
||||||
NzbDrone.Series.SeriesLayout = Backbone.Marionette.Layout.extend({
|
|
||||||
template: 'Series/SeriesLayoutTemplate',
|
|
||||||
className: "row",
|
|
||||||
route: 'Series/index',
|
|
||||||
|
|
||||||
ui: {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
regions: {
|
|
||||||
seriesRegion: '#series'
|
|
||||||
},
|
|
||||||
|
|
||||||
collection: new NzbDrone.Series.SeriesCollection(),
|
|
||||||
|
|
||||||
initialize: function (options) {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
onRender: function () {
|
|
||||||
console.log('binding auto complete');
|
|
||||||
|
|
||||||
this.collection.fetch();
|
|
||||||
|
|
||||||
this.seriesRegion.show(new NzbDrone.Series.SeriesCollectionView({ collection: this.collection }));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
|
@ -1 +0,0 @@
|
||||||
<div id="series" class="result-list span20"></div>
|
|
|
@ -1,8 +1,7 @@
|
||||||
define(['app'], function () {
|
define(['app', 'Quality/QualityProfileCollection'], function (app, qualityProfileCollection) {
|
||||||
|
|
||||||
|
|
||||||
NzbDrone.Series.SeriesModel = Backbone.Model.extend({
|
NzbDrone.Series.SeriesModel = Backbone.Model.extend({
|
||||||
url: NzbDrone.Constants.ApiRoot + '/series',
|
|
||||||
|
|
||||||
mutators: {
|
mutators: {
|
||||||
bestDateString: function () {
|
bestDateString: function () {
|
||||||
|
@ -34,9 +33,12 @@ define(['app'], function () {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
defaults: {
|
defaults: {
|
||||||
episodeFileCount: 0,
|
episodeFileCount: 0,
|
||||||
episodeCount: 0
|
episodeCount: 0,
|
||||||
|
qualityProfiles: qualityProfileCollection
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['bootstrap'], function () {
|
define([], function () {
|
||||||
|
|
||||||
$.fn.folderAutoComplete = function () {
|
$.fn.folderAutoComplete = function () {
|
||||||
$(this).typeahead({
|
$(this).typeahead({
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
model.set('title', a.pathname.split('/').pop() + ' : ' + line);
|
model.set('title', a.pathname.split('/').pop() + ' : ' + line);
|
||||||
model.set('message', msg);
|
model.set('message', msg);
|
||||||
model.set('level', 'error');
|
model.set('level', 'error');
|
||||||
self.add(model);
|
self.push(model);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
console.log("An error occurred while reporting error. " + error);
|
console.log("An error occurred while reporting error. " + error);
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText);
|
model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText);
|
||||||
model.set('message', xmlHttpRequest.responseText);
|
model.set('message', xmlHttpRequest.responseText);
|
||||||
model.set('level', 'error');
|
model.set('level', 'error');
|
||||||
self.add(model);
|
self.push(model);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,43 +5,30 @@
|
||||||
'underscore': 'JsLibraries/underscore',
|
'underscore': 'JsLibraries/underscore',
|
||||||
'marionette': 'JsLibraries/backbone.marionette',
|
'marionette': 'JsLibraries/backbone.marionette',
|
||||||
'handlebars': 'JsLibraries/handlebars',
|
'handlebars': 'JsLibraries/handlebars',
|
||||||
'bootstrap': 'JsLibraries/bootstrap',
|
'jquery': 'JsLibraries/jquery'
|
||||||
'datatablesBase': 'JsLibraries/jquery.dataTables',
|
|
||||||
'datatablesExt': 'JsLibraries/jquery.dataTables.extensions',
|
|
||||||
'datatables': 'JsLibraries/jquery.dataTables.bootstrap.pagination',
|
|
||||||
},
|
},
|
||||||
|
|
||||||
shim: {
|
shim: {
|
||||||
bootstrap: {
|
jquery:{
|
||||||
deps: ["jquery"],
|
exports:'$'
|
||||||
},
|
},
|
||||||
underscore: {
|
underscore: {
|
||||||
exports: '_'
|
exports: '_'
|
||||||
},
|
},
|
||||||
backbone: {
|
backbone: {
|
||||||
deps: ["underscore", "jquery"],
|
deps: ['underscore', 'jquery'],
|
||||||
exports: "Backbone"
|
exports: 'Backbone'
|
||||||
},
|
},
|
||||||
marionette: {
|
marionette: {
|
||||||
deps: ["backbone"],
|
deps: ['backbone'],
|
||||||
exports: "Marionette"
|
exports: 'Marionette'
|
||||||
},
|
},
|
||||||
handlebars: {
|
handlebars: {
|
||||||
exports: "Handlebars"
|
exports: 'Handlebars'
|
||||||
},
|
},
|
||||||
dataTable: {
|
dataTable: {
|
||||||
deps: ['jquery']
|
deps: ['jquery']
|
||||||
},
|
|
||||||
datatablesBase: {
|
|
||||||
depts: ['jquery']
|
|
||||||
},
|
|
||||||
datatablesExt: {
|
|
||||||
deps: ['datatablesBase'],
|
|
||||||
},
|
|
||||||
datatables: {
|
|
||||||
deps: ['datatablesExt']
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue