mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-24 08:42:19 +02:00
removed series layout.
datatables doesn't load properly.
This commit is contained in:
parent
8ba29fde94
commit
c01f982698
@ -6,12 +6,10 @@
|
||||
using FluentValidation;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extentions;
|
||||
using NzbDrone.Api.QualityProfiles;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Jobs;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
||||
namespace NzbDrone.Api.Series
|
||||
{
|
||||
@ -30,8 +28,7 @@ public SeriesModule(SeriesProvider seriesProvider, JobProvider jobProvider)
|
||||
Post["/"] = x => AddSeries();
|
||||
Put["/"] = x => UpdateSeries();
|
||||
|
||||
//Todo: Backbone failing and not sending the id properly... wtf
|
||||
Delete["/"] = x => DeleteSeries(0);
|
||||
Delete["/{id}"] = x => DeleteSeries((int)x.id);
|
||||
}
|
||||
|
||||
private Response AllSeries()
|
||||
@ -98,10 +95,8 @@ private Response UpdateSeries()
|
||||
|
||||
private Response DeleteSeries(int id)
|
||||
{
|
||||
var seriesId = Convert.ToInt32(Request.Headers["id"].FirstOrDefault());
|
||||
var deleteFiles = Convert.ToBoolean(Request.Headers["deleteFiles"].FirstOrDefault());
|
||||
|
||||
_jobProvider.QueueJob(typeof(DeleteSeriesJob), new {SeriesId = seriesId, DeleteFiles = deleteFiles});
|
||||
_jobProvider.QueueJob(typeof(DeleteSeriesJob), new { SeriesId = id, DeleteFiles = deleteFiles });
|
||||
return new Response { StatusCode = HttpStatusCode.OK };
|
||||
}
|
||||
}
|
||||
|
@ -211,6 +211,7 @@
|
||||
<Content Include="_backboneApp\AddSeries\RootFolders\RootFolderCollection.js" />
|
||||
<Content Include="_backboneApp\Content\jquery.dataTables.bootstrap.css" />
|
||||
<Content Include="_backboneApp\JsLibraries\jquery.js" />
|
||||
<Content Include="_backboneApp\JsLibraries\require.js" />
|
||||
<Content Include="_backboneApp\Routing.js" />
|
||||
<Content Include="_backboneApp\JsLibraries\backbone.modelbinder.js" />
|
||||
<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.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\qualityProfileCollection.js" />
|
||||
<Content Include="_backboneApp\Quality\qualityTypeModel.js" />
|
||||
|
@ -63,7 +63,19 @@
|
||||
<div id="footer-region" class="span20"></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>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -2,7 +2,11 @@
|
||||
<project version="4">
|
||||
<component name="ProjectCodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS">
|
||||
<value />
|
||||
<value>
|
||||
<XML>
|
||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||
</XML>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
|
@ -1,3 +1,7 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="Keivan" />
|
||||
<dictionary name="Keivan">
|
||||
<words>
|
||||
<w>mutators</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
@ -1,12 +1,12 @@
|
||||
define([
|
||||
'app',
|
||||
'AddSeries/RootFolders/RootFolderCollection',
|
||||
'Quality/QualityProfileCollection',
|
||||
'AddSeries/RootFolders/RootFolderView',
|
||||
'AddSeries/New/AddNewSeriesView',
|
||||
'AddSeries/Existing/ImportSeriesView',
|
||||
'Quality/QualityProfileCollection'
|
||||
'AddSeries/Existing/ImportSeriesView'
|
||||
],
|
||||
function (app, rootFolderCollection) {
|
||||
function (app, rootFolderCollection, qualityProfileCollection) {
|
||||
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
|
||||
template: 'AddSeries/addSeriesLayoutTemplate',
|
||||
|
||||
@ -55,8 +55,6 @@
|
||||
NzbDrone.Router.navigate('series/add/rootfolders');
|
||||
},
|
||||
|
||||
//rootFolderCollection: new NzbDrone.AddSeries.RootFolders.RootFolderCollection(),
|
||||
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
||||
|
||||
initialize: function (context, action, query) {
|
||||
if (action) {
|
||||
@ -71,10 +69,11 @@
|
||||
onRender: function () {
|
||||
|
||||
rootFolderCollection.fetch();
|
||||
qualityProfileCollection.fetch();
|
||||
|
||||
this.addNew.show(new NzbDrone.AddSeries.New.AddNewSeriesView({ qualityProfiles: this.qualityProfileCollection }));
|
||||
this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView({ quality: this.qualityProfileCollection }));
|
||||
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection }));
|
||||
this.addNew.show(new NzbDrone.AddSeries.New.AddNewSeriesView());
|
||||
this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView());
|
||||
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView());
|
||||
|
||||
this.listenTo(rootFolderCollection, 'add', this.evaluateActions, this);
|
||||
this.listenTo(rootFolderCollection, 'remove', this.evaluateActions, this);
|
||||
@ -103,7 +102,7 @@
|
||||
this.ui.addNewTab.show();
|
||||
this.ui.importExistingTab.show();
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,145 +1,139 @@
|
||||
'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({
|
||||
template: 'AddSeries/Existing/FolderMatchResultViewTemplatate',
|
||||
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
|
||||
template:'AddSeries/Existing/FolderMatchResultViewTemplatate',
|
||||
|
||||
events: {
|
||||
'click .x-btn-add': 'addSeries'
|
||||
},
|
||||
events:{
|
||||
'click .x-btn-add':'addSeries'
|
||||
},
|
||||
|
||||
addSeries: function () {
|
||||
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 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 model = new NzbDrone.Series.SeriesModel({
|
||||
seriesId:seriesId,
|
||||
title:title,
|
||||
qualityProfileId:quality,
|
||||
path:path
|
||||
});
|
||||
|
||||
var self = this;
|
||||
var self = this;
|
||||
|
||||
model.save(undefined, {
|
||||
success: function () {
|
||||
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
||||
title: 'Added',
|
||||
message: title,
|
||||
level: 'success'
|
||||
});
|
||||
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();
|
||||
notificationCollection.push(notificationModel);
|
||||
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';
|
||||
|
||||
define(['app'], function () {
|
||||
define(['app','Quality/QualityProfileCollection'], function (app, qualityProfiles) {
|
||||
|
||||
|
||||
NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({
|
||||
|
||||
defaults :{
|
||||
quality: qualityProfiles
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@ -12,23 +15,14 @@ define(['app'], function () {
|
||||
model: NzbDrone.AddSeries.Existing.UnmappedFolderModel,
|
||||
|
||||
|
||||
importItems: function (rootFolderModel, quality) {
|
||||
|
||||
if (!rootFolderModel) {
|
||||
throw "folder array is required";
|
||||
}
|
||||
|
||||
if (!quality) {
|
||||
throw "quality is required";
|
||||
}
|
||||
importItems: function (rootFolderModel) {
|
||||
|
||||
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.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({ rootFolder: rootFolder, folder: folder}));
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
|
@ -9,20 +9,11 @@
|
||||
},
|
||||
|
||||
regions: {
|
||||
searchResult: '#search-result',
|
||||
searchResult: '#search-result'
|
||||
},
|
||||
|
||||
collection: new NzbDrone.AddSeries.SearchResultCollection(),
|
||||
|
||||
initialize: function (options) {
|
||||
|
||||
if (options.qualityProfiles === undefined) {
|
||||
throw 'qualityProfiles arg. is required.';
|
||||
}
|
||||
|
||||
this.qualityProfileCollection = options.qualityProfiles;
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
console.log('binding auto complete');
|
||||
var self = this;
|
||||
@ -48,9 +39,9 @@
|
||||
context.searchResult.show(new NzbDrone.Shared.SpinnerView());
|
||||
|
||||
context.currentSearchRequest = context.collection.fetch({
|
||||
data: $.param({ term: term }),
|
||||
data: { term: term },
|
||||
success: function (model) {
|
||||
context.resultUpdated(model, context);
|
||||
context.searchResult.show(context.resultView);
|
||||
}
|
||||
});
|
||||
|
||||
@ -64,16 +55,6 @@
|
||||
console.log('aborting previous pending search request.');
|
||||
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({
|
||||
url: NzbDrone.Constants.ApiRoot + '/rootdir',
|
||||
model: NzbDrone.AddSeries.RootFolders.RootFolderModel,
|
||||
model: NzbDrone.AddSeries.RootFolders.RootFolderModel
|
||||
});
|
||||
|
||||
return new rootFolderCollection();
|
||||
|
@ -9,7 +9,7 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Shared/AutoComplet
|
||||
tagName: 'tr',
|
||||
|
||||
events: {
|
||||
'click .x-remove': 'removeFolder',
|
||||
'click .x-remove': 'removeFolder'
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
@ -19,7 +19,7 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Shared/AutoComplet
|
||||
removeFolder: function () {
|
||||
this.model.destroy({ wait: true });
|
||||
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({
|
||||
mutators: {
|
||||
@ -16,8 +16,8 @@
|
||||
},
|
||||
|
||||
defaults: {
|
||||
qualityProfiles: new NzbDrone.Quality.QualityProfileCollection(),
|
||||
rootFolders: RootFolderCollection
|
||||
qualityProfiles: qualityProfileCollection,
|
||||
rootFolders: rootFolderCollection
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -1382,6 +1382,7 @@
|
||||
Backbone.sync = function (method, model, options) {
|
||||
var type = methodMap[method];
|
||||
|
||||
|
||||
// Default options, unless specified.
|
||||
_.defaults(options || (options = {}), {
|
||||
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 */
|
||||
$.extend($.fn.dataTableExt.oStdClasses, {
|
||||
"sWrapper": "dataTables_wrapper form-horizontal"
|
||||
|
File diff suppressed because it is too large
Load Diff
2000
NzbDrone.Web/_backboneApp/JsLibraries/require.js
Normal file
2000
NzbDrone.Web/_backboneApp/JsLibraries/require.js
Normal file
File diff suppressed because it is too large
Load Diff
0
NzbDrone.Web/_backboneApp/Mixins/backbone.xhr.js
Normal file
0
NzbDrone.Web/_backboneApp/Mixins/backbone.xhr.js
Normal file
@ -1,8 +1,13 @@
|
||||
define(['app', 'Quality/QualityProfileModel'], function () {
|
||||
|
||||
NzbDrone.Quality.QualityProfileCollection = Backbone.Collection.extend({
|
||||
model: NzbDrone.Quality.QualityProfileModel,
|
||||
url: NzbDrone.Constants.ApiRoot + '/qualityprofiles'
|
||||
var qualityProfileCollection = Backbone.Collection.extend({
|
||||
model:NzbDrone.Quality.QualityProfileModel,
|
||||
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({
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
|
||||
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 () {
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
controller: new NzbDrone.Controller(),
|
||||
appRoutes: {
|
||||
'': 'series',
|
||||
'series': 'series',
|
||||
'series/index': 'series',
|
||||
'series/add': 'addSeries',
|
||||
|
@ -5,7 +5,7 @@
|
||||
<p>Are you sure you want to delete '{{title}}'?</p>
|
||||
<div class="series-delete-files">
|
||||
<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?
|
||||
</label>
|
||||
</div>
|
||||
|
@ -3,27 +3,35 @@
|
||||
define(['app', 'Series/SeriesModel'], function () {
|
||||
|
||||
NzbDrone.Series.DeleteSeriesView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Series/Delete/DeleteSeriesTemplate',
|
||||
tagName: 'div',
|
||||
className: "modal",
|
||||
template:'Series/Delete/DeleteSeriesTemplate',
|
||||
tagName:'div',
|
||||
className:"modal",
|
||||
|
||||
ui: {
|
||||
'progressbar': '.progress .bar',
|
||||
events:{
|
||||
'click .x-confirm-delete':'removeSeries'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-confirm-delete': 'removeSeries',
|
||||
ui:{
|
||||
deleteFiles:'.x-delete-files'
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
onRender:function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
},
|
||||
|
||||
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') } });
|
||||
this.model.collection.remove(this.model);
|
||||
this.$el.parent().modal('hide');
|
||||
},
|
||||
removeSeries:function () {
|
||||
|
||||
var deleteFiles = this.ui.deleteFiles.prop('checked');
|
||||
|
||||
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'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.qualityProfileCollection = options.qualityProfiles;
|
||||
this.model.set('qualityProfiles', this.qualityProfileCollection);
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
},
|
||||
|
||||
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
||||
|
||||
saveSeries: function () {
|
||||
//Todo: Get qualityProfile + backlog setting from UI
|
||||
|
@ -1,6 +1,6 @@
|
||||
define(['app', 'Series/SeriesModel'], function () {
|
||||
NzbDrone.Series.SeriesCollection = Backbone.Collection.extend({
|
||||
url: NzbDrone.Constants.ApiRoot + '/series',
|
||||
model: NzbDrone.Series.SeriesModel,
|
||||
model: NzbDrone.Series.SeriesModel
|
||||
});
|
||||
});
|
@ -1,21 +1,24 @@
|
||||
'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({
|
||||
itemView: NzbDrone.Series.SeriesItemView,
|
||||
itemViewOptions: {},
|
||||
template: 'Series/SeriesCollectionTemplate',
|
||||
tagName: 'table',
|
||||
className: 'table table-hover',
|
||||
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
||||
qualityProfileCollection: qualityProfileCollection,
|
||||
|
||||
initialize: function () {
|
||||
this.collection = new NzbDrone.Series.SeriesCollection();
|
||||
this.collection.fetch();
|
||||
this.qualityProfileCollection.fetch();
|
||||
|
||||
this.itemViewOptions = { qualityProfiles: this.qualityProfileCollection };
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
$('.table').dataTable({
|
||||
onShow: function () {
|
||||
this.$el.dataTable({
|
||||
sDom: "<'row'<'span14'l><'span6'f>r>t<'row'<'span14'i><'span6'p>>",
|
||||
sPaginationType: "bootstrap",
|
||||
bLengthChange: false,
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
define([
|
||||
'app',
|
||||
'Quality/QualityProfileCollection',
|
||||
'Series/SeriesCollection',
|
||||
'Series/Edit/EditSeriesView',
|
||||
'Series/Delete/DeleteSeriesView',
|
||||
'Quality/QualityProfileCollection'
|
||||
], function () {
|
||||
'Series/Delete/DeleteSeriesView'
|
||||
|
||||
], function (app, qualityProfileCollection) {
|
||||
|
||||
NzbDrone.Series.SeriesItemView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Series/SeriesItemTemplate',
|
||||
@ -29,10 +30,9 @@ define([
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
},
|
||||
|
||||
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
||||
|
||||
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);
|
||||
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({
|
||||
url: NzbDrone.Constants.ApiRoot + '/series',
|
||||
|
||||
mutators: {
|
||||
bestDateString: function () {
|
||||
@ -34,9 +33,12 @@ define(['app'], function () {
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
defaults: {
|
||||
episodeFileCount: 0,
|
||||
episodeCount: 0
|
||||
episodeCount: 0,
|
||||
qualityProfiles: qualityProfileCollection
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
define(['bootstrap'], function () {
|
||||
define([], function () {
|
||||
|
||||
$.fn.folderAutoComplete = function () {
|
||||
$(this).typeahead({
|
||||
|
@ -19,7 +19,7 @@
|
||||
model.set('title', a.pathname.split('/').pop() + ' : ' + line);
|
||||
model.set('message', msg);
|
||||
model.set('level', 'error');
|
||||
self.add(model);
|
||||
self.push(model);
|
||||
} catch (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('message', xmlHttpRequest.responseText);
|
||||
model.set('level', 'error');
|
||||
self.add(model);
|
||||
self.push(model);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
@ -5,43 +5,30 @@
|
||||
'underscore': 'JsLibraries/underscore',
|
||||
'marionette': 'JsLibraries/backbone.marionette',
|
||||
'handlebars': 'JsLibraries/handlebars',
|
||||
'bootstrap': 'JsLibraries/bootstrap',
|
||||
'datatablesBase': 'JsLibraries/jquery.dataTables',
|
||||
'datatablesExt': 'JsLibraries/jquery.dataTables.extensions',
|
||||
'datatables': 'JsLibraries/jquery.dataTables.bootstrap.pagination',
|
||||
'jquery': 'JsLibraries/jquery'
|
||||
},
|
||||
|
||||
shim: {
|
||||
bootstrap: {
|
||||
deps: ["jquery"],
|
||||
jquery:{
|
||||
exports:'$'
|
||||
},
|
||||
underscore: {
|
||||
exports: '_'
|
||||
},
|
||||
backbone: {
|
||||
deps: ["underscore", "jquery"],
|
||||
exports: "Backbone"
|
||||
deps: ['underscore', 'jquery'],
|
||||
exports: 'Backbone'
|
||||
},
|
||||
marionette: {
|
||||
deps: ["backbone"],
|
||||
exports: "Marionette"
|
||||
deps: ['backbone'],
|
||||
exports: 'Marionette'
|
||||
},
|
||||
handlebars: {
|
||||
exports: "Handlebars"
|
||||
exports: 'Handlebars'
|
||||
},
|
||||
dataTable: {
|
||||
deps: ['jquery']
|
||||
},
|
||||
datatablesBase: {
|
||||
depts: ['jquery']
|
||||
},
|
||||
datatablesExt: {
|
||||
deps: ['datatablesBase'],
|
||||
},
|
||||
datatables: {
|
||||
deps: ['datatablesExt']
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user