mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
rjs -> webpack
This commit is contained in:
@@ -1,14 +1,9 @@
|
||||
'use strict';
|
||||
var ThingyAddCollectionView = require('../../ThingyAddCollectionView');
|
||||
var ThingyHeaderGroupView = require('../../ThingyHeaderGroupView');
|
||||
var AddItemView = require('./DownloadClientAddItemView');
|
||||
|
||||
define([
|
||||
'Settings/ThingyAddCollectionView',
|
||||
'Settings/ThingyHeaderGroupView',
|
||||
'Settings/DownloadClient/Add/DownloadClientAddItemView'
|
||||
], function (ThingyAddCollectionView, ThingyHeaderGroupView, AddItemView) {
|
||||
|
||||
return ThingyAddCollectionView.extend({
|
||||
itemView : ThingyHeaderGroupView.extend({ itemView: AddItemView }),
|
||||
itemViewContainer: '.add-download-client .items',
|
||||
template : 'Settings/DownloadClient/Add/DownloadClientAddCollectionViewTemplate'
|
||||
});
|
||||
});
|
||||
module.exports = ThingyAddCollectionView.extend({
|
||||
itemView : ThingyHeaderGroupView.extend({itemView : AddItemView}),
|
||||
itemViewContainer : '.add-download-client .items',
|
||||
template : 'Settings/DownloadClient/Add/DownloadClientAddCollectionViewTemplate'
|
||||
});
|
||||
@@ -1,56 +1,46 @@
|
||||
'use strict';
|
||||
var _ = require('underscore');
|
||||
var $ = require('jquery');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var EditView = require('../Edit/DownloadClientEditView');
|
||||
|
||||
define([
|
||||
'underscore',
|
||||
'jquery',
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/DownloadClient/Edit/DownloadClientEditView'
|
||||
], function (_, $, AppLayout, Marionette, EditView) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/Add/DownloadClientAddItemViewTemplate',
|
||||
tagName : 'li',
|
||||
className : 'add-thingy-item',
|
||||
|
||||
events: {
|
||||
'click .x-preset': '_addPreset',
|
||||
'click' : '_add'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
|
||||
_addPreset: function (e) {
|
||||
|
||||
var presetName = $(e.target).closest('.x-preset').attr('data-id');
|
||||
|
||||
var presetData = _.where(this.model.get('presets'), {name: presetName})[0];
|
||||
|
||||
this.model.set(presetData);
|
||||
|
||||
this.model.set({
|
||||
id : undefined,
|
||||
enable : true
|
||||
});
|
||||
|
||||
var editView = new EditView({ model: this.model, targetCollection: this.targetCollection });
|
||||
AppLayout.modalRegion.show(editView);
|
||||
},
|
||||
|
||||
_add: function (e) {
|
||||
if ($(e.target).closest('.btn,.btn-group').length !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.model.set({
|
||||
id : undefined,
|
||||
enable : true
|
||||
});
|
||||
|
||||
var editView = new EditView({ model: this.model, targetCollection: this.targetCollection });
|
||||
AppLayout.modalRegion.show(editView);
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/Add/DownloadClientAddItemViewTemplate',
|
||||
tagName : 'li',
|
||||
className : 'add-thingy-item',
|
||||
events : {
|
||||
"click .x-preset" : '_addPreset',
|
||||
"click" : '_add'
|
||||
},
|
||||
initialize : function(options){
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
_addPreset : function(e){
|
||||
var presetName = $(e.target).closest('.x-preset').attr('data-id');
|
||||
var presetData = _.where(this.model.get('presets'), {name : presetName})[0];
|
||||
this.model.set(presetData);
|
||||
this.model.set({
|
||||
id : undefined,
|
||||
enable : true
|
||||
});
|
||||
var editView = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.targetCollection
|
||||
});
|
||||
AppLayout.modalRegion.show(editView);
|
||||
},
|
||||
_add : function(e){
|
||||
if($(e.target).closest('.btn,.btn-group').length !== 0) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
this.model.set({
|
||||
id : undefined,
|
||||
enable : true
|
||||
});
|
||||
var editView = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.targetCollection
|
||||
});
|
||||
AppLayout.modalRegion.show(editView);
|
||||
}
|
||||
});
|
||||
@@ -1,36 +1,33 @@
|
||||
'use strict';
|
||||
var _ = require('underscore');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Backbone = require('backbone');
|
||||
var SchemaCollection = require('../DownloadClientCollection');
|
||||
var AddCollectionView = require('./DownloadClientAddCollectionView');
|
||||
|
||||
define([
|
||||
'underscore',
|
||||
'AppLayout',
|
||||
'backbone',
|
||||
'Settings/DownloadClient/DownloadClientCollection',
|
||||
'Settings/DownloadClient/Add/DownloadClientAddCollectionView'
|
||||
], function (_, AppLayout, Backbone, SchemaCollection, AddCollectionView) {
|
||||
return ({
|
||||
|
||||
open: function (collection) {
|
||||
var schemaCollection = new SchemaCollection();
|
||||
var originalUrl = schemaCollection.url;
|
||||
schemaCollection.url = schemaCollection.url + '/schema';
|
||||
schemaCollection.fetch();
|
||||
schemaCollection.url = originalUrl;
|
||||
|
||||
var groupedSchemaCollection = new Backbone.Collection();
|
||||
|
||||
schemaCollection.on('sync', function() {
|
||||
|
||||
var groups = schemaCollection.groupBy(function(model, iterator) { return model.get('protocol'); });
|
||||
|
||||
var modelCollection = _.map(groups, function(values, key, list) {
|
||||
return { 'header': key, collection: values };
|
||||
});
|
||||
|
||||
groupedSchemaCollection.reset(modelCollection);
|
||||
module.exports = {
|
||||
open : function(collection){
|
||||
var schemaCollection = new SchemaCollection();
|
||||
var originalUrl = schemaCollection.url;
|
||||
schemaCollection.url = schemaCollection.url + '/schema';
|
||||
schemaCollection.fetch();
|
||||
schemaCollection.url = originalUrl;
|
||||
var groupedSchemaCollection = new Backbone.Collection();
|
||||
schemaCollection.on('sync', function(){
|
||||
var groups = schemaCollection.groupBy(function(model, iterator){
|
||||
return model.get('protocol');
|
||||
});
|
||||
|
||||
var view = new AddCollectionView({ collection: groupedSchemaCollection, targetCollection: collection });
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
var modelCollection = _.map(groups, function(values, key, list){
|
||||
return {
|
||||
"header" : key,
|
||||
collection : values
|
||||
};
|
||||
});
|
||||
groupedSchemaCollection.reset(modelCollection);
|
||||
});
|
||||
var view = new AddCollectionView({
|
||||
collection : groupedSchemaCollection,
|
||||
targetCollection : collection
|
||||
});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
};
|
||||
@@ -1,23 +1,15 @@
|
||||
'use strict';
|
||||
var vent = require('../../../vent');
|
||||
var Marionette = require('marionette');
|
||||
|
||||
define([
|
||||
'vent',
|
||||
'marionette'
|
||||
], function (vent, Marionette) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/DownloadClient/Delete/DownloadClientDeleteViewTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-confirm-delete': '_delete'
|
||||
},
|
||||
|
||||
_delete: function () {
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success: function () {
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/Delete/DownloadClientDeleteViewTemplate',
|
||||
events : {'click .x-confirm-delete' : '_delete'},
|
||||
_delete : function(){
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success : function(){
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,31 +1,20 @@
|
||||
'use strict';
|
||||
var Backbone = require('backbone');
|
||||
var DownloadClientModel = require('./DownloadClientModel');
|
||||
|
||||
define([
|
||||
'backbone',
|
||||
'Settings/DownloadClient/DownloadClientModel'
|
||||
], function (Backbone, DownloadClientModel) {
|
||||
|
||||
return Backbone.Collection.extend({
|
||||
model: DownloadClientModel,
|
||||
url : window.NzbDrone.ApiRoot + '/downloadclient',
|
||||
|
||||
comparator : function(left, right, collection) {
|
||||
|
||||
var result = 0;
|
||||
|
||||
if (left.get('protocol')) {
|
||||
result = -left.get('protocol').localeCompare(right.get('protocol'));
|
||||
}
|
||||
|
||||
if (result === 0 && left.get('name')) {
|
||||
result = left.get('name').localeCompare(right.get('name'));
|
||||
}
|
||||
|
||||
if (result === 0) {
|
||||
result = left.get('implementation').localeCompare(right.get('implementation'));
|
||||
}
|
||||
|
||||
return result;
|
||||
module.exports = Backbone.Collection.extend({
|
||||
model : DownloadClientModel,
|
||||
url : window.NzbDrone.ApiRoot + '/downloadclient',
|
||||
comparator : function(left, right, collection){
|
||||
var result = 0;
|
||||
if(left.get('protocol')) {
|
||||
result = -left.get('protocol').localeCompare(right.get('protocol'));
|
||||
}
|
||||
});
|
||||
});
|
||||
if(result === 0 && left.get('name')) {
|
||||
result = left.get('name').localeCompare(right.get('name'));
|
||||
}
|
||||
if(result === 0) {
|
||||
result = left.get('implementation').localeCompare(right.get('implementation'));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
@@ -1,29 +1,17 @@
|
||||
'use strict';
|
||||
var Marionette = require('marionette');
|
||||
var ItemView = require('./DownloadClientItemView');
|
||||
var SchemaModal = require('./Add/DownloadClientSchemaModal');
|
||||
|
||||
define([
|
||||
'marionette',
|
||||
'Settings/DownloadClient/DownloadClientItemView',
|
||||
'Settings/DownloadClient/Add/DownloadClientSchemaModal'
|
||||
], function (Marionette, ItemView, SchemaModal) {
|
||||
return Marionette.CompositeView.extend({
|
||||
itemView : ItemView,
|
||||
itemViewContainer: '.download-client-list',
|
||||
template : 'Settings/DownloadClient/DownloadClientCollectionViewTemplate',
|
||||
|
||||
ui: {
|
||||
'addCard': '.x-add-card'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-add-card': '_openSchemaModal'
|
||||
},
|
||||
|
||||
appendHtml: function (collectionView, itemView, index) {
|
||||
collectionView.ui.addCard.parent('li').before(itemView.el);
|
||||
},
|
||||
|
||||
_openSchemaModal: function () {
|
||||
SchemaModal.open(this.collection);
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.CompositeView.extend({
|
||||
itemView : ItemView,
|
||||
itemViewContainer : '.download-client-list',
|
||||
template : 'Settings/DownloadClient/DownloadClientCollectionViewTemplate',
|
||||
ui : {"addCard" : '.x-add-card'},
|
||||
events : {"click .x-add-card" : '_openSchemaModal'},
|
||||
appendHtml : function(collectionView, itemView, index){
|
||||
collectionView.ui.addCard.parent('li').before(itemView.el);
|
||||
},
|
||||
_openSchemaModal : function(){
|
||||
SchemaModal.open(this.collection);
|
||||
}
|
||||
});
|
||||
@@ -1,26 +1,19 @@
|
||||
'use strict';
|
||||
var AppLayout = require('../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var EditView = require('./Edit/DownloadClientEditView');
|
||||
|
||||
define([
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/DownloadClient/Edit/DownloadClientEditView'
|
||||
], function (AppLayout, Marionette, EditView) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/DownloadClient/DownloadClientItemViewTemplate',
|
||||
tagName : 'li',
|
||||
|
||||
events: {
|
||||
'click' : '_edit'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
|
||||
_edit: function () {
|
||||
var view = new EditView({ model: this.model, targetCollection: this.model.collection});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/DownloadClientItemViewTemplate',
|
||||
tagName : 'li',
|
||||
events : {"click" : '_edit'},
|
||||
initialize : function(){
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
_edit : function(){
|
||||
var view = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.model.collection
|
||||
});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
@@ -1,37 +1,29 @@
|
||||
'use strict';
|
||||
var Marionette = require('marionette');
|
||||
var DownloadClientCollection = require('./DownloadClientCollection');
|
||||
var DownloadClientCollectionView = require('./DownloadClientCollectionView');
|
||||
var DownloadHandlingView = require('./DownloadHandling/DownloadHandlingView');
|
||||
var DroneFactoryView = require('./DroneFactory/DroneFactoryView');
|
||||
var RemotePathMappingCollection = require('./RemotePathMapping/RemotePathMappingCollection');
|
||||
var RemotePathMappingCollectionView = require('./RemotePathMapping/RemotePathMappingCollectionView');
|
||||
|
||||
define([
|
||||
'marionette',
|
||||
'Settings/DownloadClient/DownloadClientCollection',
|
||||
'Settings/DownloadClient/DownloadClientCollectionView',
|
||||
'Settings/DownloadClient/DownloadHandling/DownloadHandlingView',
|
||||
'Settings/DownloadClient/DroneFactory/DroneFactoryView',
|
||||
'Settings/DownloadClient/RemotePathMapping/RemotePathMappingCollection',
|
||||
'Settings/DownloadClient/RemotePathMapping/RemotePathMappingCollectionView'
|
||||
], function (Marionette, DownloadClientCollection, DownloadClientCollectionView, DownloadHandlingView, DroneFactoryView, RemotePathMappingCollection, RemotePathMappingCollectionView) {
|
||||
|
||||
return Marionette.Layout.extend({
|
||||
template : 'Settings/DownloadClient/DownloadClientLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
downloadClients : '#x-download-clients-region',
|
||||
downloadHandling : '#x-download-handling-region',
|
||||
droneFactory : '#x-dronefactory-region',
|
||||
remotePathMappings : '#x-remotepath-mapping-region'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.downloadClientsCollection = new DownloadClientCollection();
|
||||
this.downloadClientsCollection.fetch();
|
||||
this.remotePathMappingCollection = new RemotePathMappingCollection();
|
||||
this.remotePathMappingCollection.fetch();
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.downloadClients.show(new DownloadClientCollectionView({ collection: this.downloadClientsCollection }));
|
||||
this.downloadHandling.show(new DownloadHandlingView({ model: this.model }));
|
||||
this.droneFactory.show(new DroneFactoryView({ model: this.model }));
|
||||
this.remotePathMappings.show(new RemotePathMappingCollectionView({ collection: this.remotePathMappingCollection }));
|
||||
}
|
||||
});
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Settings/DownloadClient/DownloadClientLayoutTemplate',
|
||||
regions : {
|
||||
downloadClients : '#x-download-clients-region',
|
||||
downloadHandling : '#x-download-handling-region',
|
||||
droneFactory : '#x-dronefactory-region',
|
||||
remotePathMappings : '#x-remotepath-mapping-region'
|
||||
},
|
||||
initialize : function(){
|
||||
this.downloadClientsCollection = new DownloadClientCollection();
|
||||
this.downloadClientsCollection.fetch();
|
||||
this.remotePathMappingCollection = new RemotePathMappingCollection();
|
||||
this.remotePathMappingCollection.fetch();
|
||||
},
|
||||
onShow : function(){
|
||||
this.downloadClients.show(new DownloadClientCollectionView({collection : this.downloadClientsCollection}));
|
||||
this.downloadHandling.show(new DownloadHandlingView({model : this.model}));
|
||||
this.droneFactory.show(new DroneFactoryView({model : this.model}));
|
||||
this.remotePathMappings.show(new RemotePathMappingCollectionView({collection : this.remotePathMappingCollection}));
|
||||
}
|
||||
});
|
||||
@@ -1,9 +1,3 @@
|
||||
'use strict';
|
||||
var ProviderSettingsModelBase = require('../ProviderSettingsModelBase');
|
||||
|
||||
define([
|
||||
'Settings/ProviderSettingsModelBase'
|
||||
], function (ProviderSettingsModelBase) {
|
||||
return ProviderSettingsModelBase.extend({
|
||||
|
||||
});
|
||||
});
|
||||
module.exports = ProviderSettingsModelBase.extend({});
|
||||
@@ -1,11 +1,7 @@
|
||||
'use strict';
|
||||
var SettingsModelBase = require('../SettingsModelBase');
|
||||
|
||||
define([
|
||||
'Settings/SettingsModelBase'
|
||||
], function (SettingsModelBase) {
|
||||
return SettingsModelBase.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/config/downloadclient',
|
||||
successMessage: 'Download client settings saved',
|
||||
errorMessage : 'Failed to save download client settings'
|
||||
});
|
||||
});
|
||||
module.exports = SettingsModelBase.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/config/downloadclient',
|
||||
successMessage : 'Download client settings saved',
|
||||
errorMessage : 'Failed to save download client settings'
|
||||
});
|
||||
@@ -1,60 +1,48 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView'
|
||||
], function (Marionette, AsModelBoundView, AsValidatedView) {
|
||||
var Marionette = require('marionette');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/DownloadClient/DownloadHandling/DownloadHandlingViewTemplate',
|
||||
|
||||
ui: {
|
||||
completedDownloadHandlingCheckbox : '.x-completed-download-handling',
|
||||
completedDownloadOptions : '.x-completed-download-options',
|
||||
failedAutoRedownladCheckbox : '.x-failed-auto-redownload',
|
||||
failedDownloadOptions : '.x-failed-download-options'
|
||||
},
|
||||
|
||||
events: {
|
||||
'change .x-completed-download-handling' : '_setCompletedDownloadOptionsVisibility',
|
||||
'change .x-failed-auto-redownload' : '_setFailedDownloadOptionsVisibility'
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
if (!this.ui.completedDownloadHandlingCheckbox.prop('checked')) {
|
||||
this.ui.completedDownloadOptions.hide();
|
||||
}
|
||||
if (!this.ui.failedAutoRedownladCheckbox.prop('checked')) {
|
||||
this.ui.failedDownloadOptions.hide();
|
||||
}
|
||||
},
|
||||
|
||||
_setCompletedDownloadOptionsVisibility: function () {
|
||||
var checked = this.ui.completedDownloadHandlingCheckbox.prop('checked');
|
||||
if (checked) {
|
||||
this.ui.completedDownloadOptions.slideDown();
|
||||
}
|
||||
|
||||
else {
|
||||
this.ui.completedDownloadOptions.slideUp();
|
||||
}
|
||||
},
|
||||
|
||||
_setFailedDownloadOptionsVisibility: function () {
|
||||
var checked = this.ui.failedAutoRedownladCheckbox.prop('checked');
|
||||
if (checked) {
|
||||
this.ui.failedDownloadOptions.slideDown();
|
||||
}
|
||||
|
||||
else {
|
||||
this.ui.failedDownloadOptions.slideUp();
|
||||
}
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/DownloadHandling/DownloadHandlingViewTemplate',
|
||||
ui : {
|
||||
completedDownloadHandlingCheckbox : '.x-completed-download-handling',
|
||||
completedDownloadOptions : '.x-completed-download-options',
|
||||
failedAutoRedownladCheckbox : '.x-failed-auto-redownload',
|
||||
failedDownloadOptions : '.x-failed-download-options'
|
||||
},
|
||||
events : {
|
||||
"change .x-completed-download-handling" : '_setCompletedDownloadOptionsVisibility',
|
||||
"change .x-failed-auto-redownload" : '_setFailedDownloadOptionsVisibility'
|
||||
},
|
||||
onRender : function(){
|
||||
if(!this.ui.completedDownloadHandlingCheckbox.prop('checked')) {
|
||||
this.ui.completedDownloadOptions.hide();
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
|
||||
return view;
|
||||
if(!this.ui.failedAutoRedownladCheckbox.prop('checked')) {
|
||||
this.ui.failedDownloadOptions.hide();
|
||||
}
|
||||
},
|
||||
_setCompletedDownloadOptionsVisibility : function(){
|
||||
var checked = this.ui.completedDownloadHandlingCheckbox.prop('checked');
|
||||
if(checked) {
|
||||
this.ui.completedDownloadOptions.slideDown();
|
||||
}
|
||||
else {
|
||||
this.ui.completedDownloadOptions.slideUp();
|
||||
}
|
||||
},
|
||||
_setFailedDownloadOptionsVisibility : function(){
|
||||
var checked = this.ui.failedAutoRedownladCheckbox.prop('checked');
|
||||
if(checked) {
|
||||
this.ui.failedDownloadOptions.slideDown();
|
||||
}
|
||||
else {
|
||||
this.ui.failedDownloadOptions.slideUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
return view;
|
||||
}).call(this);
|
||||
@@ -1,26 +1,17 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView',
|
||||
'Mixins/FileBrowser'
|
||||
], function (Marionette, AsModelBoundView, AsValidatedView) {
|
||||
var Marionette = require('marionette');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
require('../../../Mixins/FileBrowser');
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/DownloadClient/DroneFactory/DroneFactoryViewTemplate',
|
||||
|
||||
ui: {
|
||||
droneFactory : '.x-path'
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.ui.droneFactory.fileBrowser();
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
|
||||
return view;
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/DroneFactory/DroneFactoryViewTemplate',
|
||||
ui : {droneFactory : '.x-path'},
|
||||
onShow : function(){
|
||||
this.ui.droneFactory.fileBrowser();
|
||||
}
|
||||
});
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
return view;
|
||||
}).call(this);
|
||||
@@ -1,66 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'underscore',
|
||||
'vent',
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/DownloadClient/Delete/DownloadClientDeleteView',
|
||||
'Commands/CommandController',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView',
|
||||
'Mixins/AsEditModalView',
|
||||
'Form/FormBuilder',
|
||||
'Mixins/FileBrowser',
|
||||
'bootstrap'
|
||||
], function (_, vent, AppLayout, Marionette, DeleteView, CommandController, AsModelBoundView, AsValidatedView, AsEditModalView) {
|
||||
var _ = require('underscore');
|
||||
var vent = require('../../../vent');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var DeleteView = require('../Delete/DownloadClientDeleteView');
|
||||
var CommandController = require('../../../Commands/CommandController');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
var AsEditModalView = require('../../../Mixins/AsEditModalView');
|
||||
require('../../../Form/FormBuilder');
|
||||
require('../../../Mixins/FileBrowser');
|
||||
require('bootstrap');
|
||||
require('../Add/DownloadClientSchemaModal');
|
||||
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/DownloadClient/Edit/DownloadClientEditViewTemplate',
|
||||
|
||||
ui: {
|
||||
template : 'Settings/DownloadClient/Edit/DownloadClientEditViewTemplate',
|
||||
ui : {
|
||||
path : '.x-path',
|
||||
modalBody : '.modal-body'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-back' : '_back'
|
||||
},
|
||||
|
||||
_deleteView: DeleteView,
|
||||
|
||||
initialize: function (options) {
|
||||
events : {"click .x-back" : '_back'},
|
||||
_deleteView : DeleteView,
|
||||
initialize : function(options){
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
//Hack to deal with modals not overflowing
|
||||
if (this.ui.path.length > 0) {
|
||||
onShow : function(){
|
||||
if(this.ui.path.length > 0) {
|
||||
this.ui.modalBody.addClass('modal-overflow');
|
||||
}
|
||||
|
||||
this.ui.path.fileBrowser();
|
||||
},
|
||||
|
||||
_onAfterSave: function () {
|
||||
this.targetCollection.add(this.model, { merge: true });
|
||||
_onAfterSave : function(){
|
||||
this.targetCollection.add(this.model, {merge : true});
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
},
|
||||
|
||||
_onAfterSaveAndAdd: function () {
|
||||
this.targetCollection.add(this.model, { merge: true });
|
||||
|
||||
require('Settings/DownloadClient/Add/DownloadClientSchemaModal').open(this.targetCollection);
|
||||
_onAfterSaveAndAdd : function(){
|
||||
this.targetCollection.add(this.model, {merge : true});
|
||||
require('../Add/DownloadClientSchemaModal').open(this.targetCollection);
|
||||
},
|
||||
|
||||
_back: function () {
|
||||
require('Settings/DownloadClient/Add/DownloadClientSchemaModal').open(this.targetCollection);
|
||||
_back : function(){
|
||||
require('../Add/DownloadClientSchemaModal').open(this.targetCollection);
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
AsEditModalView.call(view);
|
||||
|
||||
return view;
|
||||
});
|
||||
}).call(this);
|
||||
@@ -1,11 +1,7 @@
|
||||
'use strict';
|
||||
define([
|
||||
'backbone',
|
||||
'Settings/DownloadClient/RemotePathMapping/RemotePathMappingModel'
|
||||
], function (Backbone, RemotePathMappingModel) {
|
||||
var Backbone = require('backbone');
|
||||
var RemotePathMappingModel = require('./RemotePathMappingModel');
|
||||
|
||||
return Backbone.Collection.extend({
|
||||
model : RemotePathMappingModel,
|
||||
url : window.NzbDrone.ApiRoot + '/remotePathMapping'
|
||||
});
|
||||
});
|
||||
module.exports = Backbone.Collection.extend({
|
||||
model : RemotePathMappingModel,
|
||||
url : window.NzbDrone.ApiRoot + '/remotePathMapping'
|
||||
});
|
||||
+21
-27
@@ -1,28 +1,22 @@
|
||||
'use strict';
|
||||
define([
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/DownloadClient/RemotePathMapping/RemotePathMappingItemView',
|
||||
'Settings/DownloadClient/RemotePathMapping/RemotePathMappingEditView',
|
||||
'Settings/DownloadClient/RemotePathMapping/RemotePathMappingModel',
|
||||
'bootstrap'
|
||||
], function (AppLayout, Marionette, RemotePathMappingItemView, EditView, RemotePathMappingModel) {
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var RemotePathMappingItemView = require('./RemotePathMappingItemView');
|
||||
var EditView = require('./RemotePathMappingEditView');
|
||||
var RemotePathMappingModel = require('./RemotePathMappingModel');
|
||||
require('bootstrap');
|
||||
|
||||
return Marionette.CompositeView.extend({
|
||||
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingCollectionViewTemplate',
|
||||
itemViewContainer : '.x-rows',
|
||||
itemView : RemotePathMappingItemView,
|
||||
|
||||
events: {
|
||||
'click .x-add' : '_addMapping'
|
||||
},
|
||||
|
||||
_addMapping: function() {
|
||||
var model = new RemotePathMappingModel();
|
||||
model.collection = this.collection;
|
||||
|
||||
var view = new EditView({ model: model, targetCollection: this.collection});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.CompositeView.extend({
|
||||
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingCollectionViewTemplate',
|
||||
itemViewContainer : '.x-rows',
|
||||
itemView : RemotePathMappingItemView,
|
||||
events : {"click .x-add" : '_addMapping'},
|
||||
_addMapping : function(){
|
||||
var model = new RemotePathMappingModel();
|
||||
model.collection = this.collection;
|
||||
var view = new EditView({
|
||||
model : model,
|
||||
targetCollection : this.collection
|
||||
});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
@@ -1,23 +1,15 @@
|
||||
'use strict';
|
||||
var vent = require('../../../vent');
|
||||
var Marionette = require('marionette');
|
||||
|
||||
define([
|
||||
'vent',
|
||||
'marionette'
|
||||
], function (vent, Marionette) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingDeleteViewTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-confirm-delete': '_delete'
|
||||
},
|
||||
|
||||
_delete: function () {
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success: function () {
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingDeleteViewTemplate',
|
||||
events : {"click .x-confirm-delete" : '_delete'},
|
||||
_delete : function(){
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success : function(){
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,51 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'underscore',
|
||||
'vent',
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/DownloadClient/RemotePathMapping/RemotePathMappingDeleteView',
|
||||
'Commands/CommandController',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView',
|
||||
'Mixins/AsEditModalView',
|
||||
'Mixins/FileBrowser',
|
||||
'bootstrap'
|
||||
], function (_, vent, AppLayout, Marionette, DeleteView, CommandController, AsModelBoundView, AsValidatedView, AsEditModalView) {
|
||||
var _ = require('underscore');
|
||||
var vent = require('../../../vent');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var DeleteView = require('./RemotePathMappingDeleteView');
|
||||
var CommandController = require('../../../Commands/CommandController');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
var AsEditModalView = require('../../../Mixins/AsEditModalView');
|
||||
require('../../../Mixins/FileBrowser');
|
||||
require('bootstrap');
|
||||
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingEditViewTemplate',
|
||||
|
||||
ui : {
|
||||
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingEditViewTemplate',
|
||||
ui : {
|
||||
path : '.x-path',
|
||||
modalBody : '.modal-body'
|
||||
},
|
||||
|
||||
_deleteView: DeleteView,
|
||||
|
||||
initialize : function (options) {
|
||||
_deleteView : DeleteView,
|
||||
initialize : function(options){
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
|
||||
onShow : function () {
|
||||
//Hack to deal with modals not overflowing
|
||||
if (this.ui.path.length > 0) {
|
||||
onShow : function(){
|
||||
if(this.ui.path.length > 0) {
|
||||
this.ui.modalBody.addClass('modal-overflow');
|
||||
}
|
||||
|
||||
this.ui.path.fileBrowser();
|
||||
},
|
||||
|
||||
_onAfterSave : function () {
|
||||
this.targetCollection.add(this.model, { merge : true });
|
||||
_onAfterSave : function(){
|
||||
this.targetCollection.add(this.model, {merge : true});
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
AsEditModalView.call(view);
|
||||
|
||||
return view;
|
||||
});
|
||||
}).call(this);
|
||||
@@ -1,26 +1,19 @@
|
||||
'use strict';
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var EditView = require('./RemotePathMappingEditView');
|
||||
|
||||
define([
|
||||
'AppLayout',
|
||||
'marionette',
|
||||
'Settings/DownloadClient/RemotePathMapping/RemotePathMappingEditView'
|
||||
], function (AppLayout, Marionette, EditView) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingItemViewTemplate',
|
||||
className : 'row',
|
||||
|
||||
events: {
|
||||
'click .x-edit' : '_editMapping'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
|
||||
_editMapping: function() {
|
||||
var view = new EditView({ model: this.model, targetCollection: this.model.collection});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/RemotePathMapping/RemotePathMappingItemViewTemplate',
|
||||
className : 'row',
|
||||
events : {"click .x-edit" : '_editMapping'},
|
||||
initialize : function(){
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
_editMapping : function(){
|
||||
var view = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.model.collection
|
||||
});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
@@ -1,10 +1,4 @@
|
||||
'use strict';
|
||||
var $ = require('jquery');
|
||||
var DeepModel = require('backbone.deepmodel');
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'backbone.deepmodel'
|
||||
], function ($, DeepModel) {
|
||||
return DeepModel.DeepModel.extend({
|
||||
|
||||
});
|
||||
});
|
||||
module.exports = DeepModel.DeepModel.extend({});
|
||||
Reference in New Issue
Block a user