mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
removed NzbDrone. namespace, everything is done using require.
This commit is contained in:
parent
ef62af75df
commit
b0bd3f34f1
121 changed files with 2570 additions and 2587 deletions
|
@ -1,79 +1,81 @@
|
|||
'use strict';
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'app', 'marionette', 'Mixins/AsModelBoundView', 'bootstrap'
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Mixins/AsModelBoundView',
|
||||
'bootstrap'
|
||||
], function (Marionette, AsModelBoundView) {
|
||||
|
||||
], function (App, Marionette, AsModelBoundView) {
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/DownloadClientTemplate',
|
||||
className: 'form-horizontal',
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/DownloadClient/DownloadClientTemplate',
|
||||
className: 'form-horizontal',
|
||||
ui: {
|
||||
bsSwitch : '.switch',
|
||||
tooltip : '.help-inline i',
|
||||
pathInput : '.x-path',
|
||||
sabConfig : '.x-sab-config',
|
||||
blackholeConfig : '.x-blackhole-config',
|
||||
pneumaticConfig : '.x-pneumatic-config',
|
||||
nzbGetConfig : '.x-nzbget-config',
|
||||
downloadClientSelect: '.x-download-client'
|
||||
},
|
||||
|
||||
ui: {
|
||||
bsSwitch : '.switch',
|
||||
tooltip : '.help-inline i',
|
||||
pathInput : '.x-path',
|
||||
sabConfig : '.x-sab-config',
|
||||
blackholeConfig : '.x-blackhole-config',
|
||||
pneumaticConfig : '.x-pneumatic-config',
|
||||
nzbGetConfig : '.x-nzbget-config',
|
||||
downloadClientSelect: '.x-download-client'
|
||||
},
|
||||
events: {
|
||||
'change .x-download-client': 'downloadClientChanged'
|
||||
},
|
||||
|
||||
events: {
|
||||
'change .x-download-client': 'downloadClientChanged'
|
||||
},
|
||||
onRender: function () {
|
||||
this.ui.pathInput.autoComplete('/directories');
|
||||
this.refreshUIVisibility(this.model.get('downloadClient'));
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.ui.pathInput.autoComplete('/directories');
|
||||
this.refreshUIVisibility(this.model.get('downloadClient'));
|
||||
},
|
||||
downloadClientChanged: function () {
|
||||
var clientId = this.ui.downloadClientSelect.val();
|
||||
this.refreshUIVisibility(clientId);
|
||||
},
|
||||
|
||||
downloadClientChanged: function () {
|
||||
var clientId = this.ui.downloadClientSelect.val();
|
||||
this.refreshUIVisibility(clientId);
|
||||
},
|
||||
refreshUIVisibility: function (clientId) {
|
||||
|
||||
refreshUIVisibility: function (clientId) {
|
||||
if (!clientId) {
|
||||
clientId = 'sabnzbd';
|
||||
}
|
||||
|
||||
if (!clientId) {
|
||||
clientId = 'sabnzbd';
|
||||
switch (clientId.toString()) {
|
||||
case 'sabnzbd':
|
||||
this.ui.sabConfig.show();
|
||||
this.ui.blackholeConfig.hide();
|
||||
this.ui.pneumaticConfig.hide();
|
||||
this.ui.nzbGetConfig.hide();
|
||||
break;
|
||||
|
||||
case 'blackhole':
|
||||
this.ui.sabConfig.hide();
|
||||
this.ui.blackholeConfig.show();
|
||||
this.ui.pneumaticConfig.hide();
|
||||
this.ui.nzbGetConfig.hide();
|
||||
break;
|
||||
|
||||
case 'pneumatic':
|
||||
this.ui.sabConfig.hide();
|
||||
this.ui.blackholeConfig.hide();
|
||||
this.ui.pneumaticConfig.show();
|
||||
this.ui.nzbGetConfig.hide();
|
||||
break;
|
||||
|
||||
case 'nzbget':
|
||||
this.ui.sabConfig.hide();
|
||||
this.ui.blackholeConfig.hide();
|
||||
this.ui.pneumaticConfig.hide();
|
||||
this.ui.nzbGetConfig.show();
|
||||
break;
|
||||
|
||||
default :
|
||||
throw 'unknown download client id' + clientId;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
switch (clientId.toString()) {
|
||||
case 'sabnzbd':
|
||||
this.ui.sabConfig.show();
|
||||
this.ui.blackholeConfig.hide();
|
||||
this.ui.pneumaticConfig.hide();
|
||||
this.ui.nzbGetConfig.hide();
|
||||
break;
|
||||
|
||||
case 'blackhole':
|
||||
this.ui.sabConfig.hide();
|
||||
this.ui.blackholeConfig.show();
|
||||
this.ui.pneumaticConfig.hide();
|
||||
this.ui.nzbGetConfig.hide();
|
||||
break;
|
||||
|
||||
case 'pneumatic':
|
||||
this.ui.sabConfig.hide();
|
||||
this.ui.blackholeConfig.hide();
|
||||
this.ui.pneumaticConfig.show();
|
||||
this.ui.nzbGetConfig.hide();
|
||||
break;
|
||||
|
||||
case 'nzbget':
|
||||
this.ui.sabConfig.hide();
|
||||
this.ui.blackholeConfig.hide();
|
||||
this.ui.pneumaticConfig.hide();
|
||||
this.ui.nzbGetConfig.show();
|
||||
break;
|
||||
|
||||
default :
|
||||
throw 'unknown download client id' + clientId;
|
||||
}
|
||||
}
|
||||
return AsModelBoundView.call(view);
|
||||
});
|
||||
|
||||
return AsModelBoundView.call(view);
|
||||
});
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
'use strict';
|
||||
define(['app', 'backbone', 'Mixins/AsChangeTrackingModel'], function (App, Backbone, AsChangeTrackingModel) {
|
||||
var model = Backbone.Model.extend({
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'Mixins/AsChangeTrackingModel'
|
||||
], function (Backbone, AsChangeTrackingModel) {
|
||||
var model = Backbone.Model.extend({
|
||||
|
||||
url: App.Constants.ApiRoot + '/settings/host',
|
||||
url: window.ApiRoot + '/settings/host',
|
||||
|
||||
initialize: function () {
|
||||
this.on('change', function () {
|
||||
this.isSaved = false;
|
||||
}, this);
|
||||
initialize: function () {
|
||||
this.on('change', function () {
|
||||
this.isSaved = false;
|
||||
}, this);
|
||||
|
||||
this.on('sync', function () {
|
||||
this.isSaved = true;
|
||||
}, this);
|
||||
}
|
||||
this.on('sync', function () {
|
||||
this.isSaved = true;
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
|
||||
return AsChangeTrackingModel.call(model);
|
||||
});
|
||||
|
||||
return AsChangeTrackingModel.call(model);
|
||||
});
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
'use strict';
|
||||
define(['app', 'Settings/Indexers/Model'], function (App, IndexerModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url : App.Constants.ApiRoot + '/indexer',
|
||||
model: IndexerModel
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'Settings/Indexers/Model'
|
||||
], function (IndexerModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url : window.ApiRoot + '/indexer',
|
||||
model: IndexerModel
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
'use strict';
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'app',
|
||||
'marionette',
|
||||
'Mixins/AsModelBoundView'
|
||||
], function (App, Marionette, AsModelBoundView) {
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Mixins/AsModelBoundView'
|
||||
], function (Marionette, AsModelBoundView) {
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/EditTemplate',
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/EditTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-save': 'save'
|
||||
},
|
||||
events: {
|
||||
'click .x-save': 'save'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.indexerCollection = options.indexerCollection;
|
||||
},
|
||||
initialize: function (options) {
|
||||
this.indexerCollection = options.indexerCollection;
|
||||
},
|
||||
|
||||
save: function () {
|
||||
this.model.saveSettings();
|
||||
}
|
||||
save: function () {
|
||||
this.model.saveSettings();
|
||||
}
|
||||
});
|
||||
|
||||
return AsModelBoundView.call(view);
|
||||
});
|
||||
|
||||
return AsModelBoundView.call(view);
|
||||
});
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
'use strict';
|
||||
define(['app',
|
||||
'Settings/SettingsModelBase'], function (App, ModelBase) {
|
||||
return ModelBase.extend({
|
||||
url : App.Constants.ApiRoot + '/config/naming',
|
||||
successMessage: 'Naming settings saved',
|
||||
errorMessage : 'Couldn\'t save naming settings'
|
||||
});
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'Settings/SettingsModelBase'
|
||||
], function (ModelBase) {
|
||||
return ModelBase.extend({
|
||||
url : window.ApiRoot + '/config/naming',
|
||||
successMessage: 'Naming settings saved',
|
||||
errorMessage : 'Couldn\'t save naming settings'
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
'use strict';
|
||||
define(['app',
|
||||
'marionette',
|
||||
'Settings/Naming/NamingModel',
|
||||
'Mixins/AsModelBoundView'], function (App, Marionette, NamingModel, AsModelBoundView) {
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Settings/Naming/NamingModel',
|
||||
'Mixins/AsModelBoundView'
|
||||
], function (Marionette, NamingModel, AsModelBoundView) {
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Naming/NamingTemplate',
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Naming/NamingTemplate',
|
||||
|
||||
initialize: function () {
|
||||
this.model = new NamingModel();
|
||||
this.model.fetch();
|
||||
}
|
||||
initialize: function () {
|
||||
this.model = new NamingModel();
|
||||
this.model.fetch();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return AsModelBoundView.call(view);
|
||||
});
|
||||
|
||||
return AsModelBoundView.call(view);
|
||||
});
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
'use strict';
|
||||
define(['app', 'Settings/Notifications/Model'], function (App, NotificationModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url : App.Constants.ApiRoot + '/notification',
|
||||
model: NotificationModel
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'Settings/Notifications/Model'
|
||||
], function (NotificationModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url : window.ApiRoot + '/notification',
|
||||
model: NotificationModel
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
'use strict';
|
||||
define(['app', 'backbone.deepmodel'], function (App, DeepModel) {
|
||||
return DeepModel.DeepModel.extend({
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone.deepmodel'
|
||||
], function (DeepModel) {
|
||||
return DeepModel.DeepModel.extend({
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
11
UI/Settings/Quality/Profile/DeleteTemplate.html
Normal file
11
UI/Settings/Quality/Profile/DeleteTemplate.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>Delete: {{name}}</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure you want to delete '{{name}}'?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">cancel</button>
|
||||
<button class="btn btn-danger x-confirm-delete">delete</button>
|
||||
</div>
|
24
UI/Settings/Quality/Profile/DeleteView.js
Normal file
24
UI/Settings/Quality/Profile/DeleteView.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'marionette'
|
||||
], function (App, Marionette) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Quality/Profile/DeleteTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-confirm-delete': '_removeProfile'
|
||||
},
|
||||
|
||||
_removeProfile: function () {
|
||||
|
||||
this.model.destroy({
|
||||
wait: true
|
||||
}).done(function () {
|
||||
App.modalRegion.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,35 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'app',
|
||||
'marionette',
|
||||
'Settings/Quality/Profile/EditQualityProfileView',
|
||||
'Mixins/AsModelBoundView'
|
||||
], function (App, Marionette, EditProfileView, AsModelBoundView) {
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'marionette',
|
||||
'Settings/Quality/Profile/EditQualityProfileView',
|
||||
'Settings/Quality/Profile/DeleteView',
|
||||
'Mixins/AsModelBoundView'
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Quality/Profile/QualityProfileTemplate',
|
||||
tagName : 'tr',
|
||||
], function (App, Marionette, EditProfileView, DeleteProfileView, AsModelBoundView) {
|
||||
|
||||
ui: {
|
||||
'progressbar': '.progress .bar'
|
||||
},
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Quality/Profile/QualityProfileTemplate',
|
||||
tagName : 'tr',
|
||||
|
||||
events: {
|
||||
'click .x-edit' : 'edit',
|
||||
'click .x-remove': 'removeQuality'
|
||||
},
|
||||
ui: {
|
||||
'progressbar': '.progress .bar'
|
||||
},
|
||||
|
||||
edit: function () {
|
||||
var view = new EditProfileView({ model: this.model});
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
events: {
|
||||
'click .x-edit' : 'edit',
|
||||
'click .x-remove': 'removeQuality'
|
||||
},
|
||||
|
||||
removeQuality: function () {
|
||||
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
|
||||
NzbDrone.modalRegion.show(view);
|
||||
}
|
||||
edit: function () {
|
||||
var view = new EditProfileView({ model: this.model});
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
|
||||
removeQuality: function () {
|
||||
var view = new DeleteProfileView({ model: this.model });
|
||||
App.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return AsModelBoundView.call(view);
|
||||
});
|
||||
|
||||
return AsModelBoundView.call(view);
|
||||
});
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
'use strict';
|
||||
define([
|
||||
'app',
|
||||
'marionette',
|
||||
'Quality/QualityProfileCollection',
|
||||
'Settings/Quality/Profile/QualityProfileCollectionView',
|
||||
'Quality/QualitySizeCollection',
|
||||
'Settings/Quality/Size/QualitySizeCollectionView'
|
||||
],
|
||||
function (App, Marionette, QualityProfileCollection, QualityProfileCollectionView, QualitySizeCollection, QualitySizeCollectionView) {
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Quality/QualityProfileCollection',
|
||||
'Settings/Quality/Profile/QualityProfileCollectionView',
|
||||
'Quality/QualitySizeCollection',
|
||||
'Settings/Quality/Size/QualitySizeCollectionView'
|
||||
], function (Marionette, QualityProfileCollection, QualityProfileCollectionView, QualitySizeCollection, QualitySizeCollectionView) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Settings/Quality/QualityLayoutTemplate',
|
||||
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
'use strict';
|
||||
define([
|
||||
'app',
|
||||
'marionette',
|
||||
'Settings/SettingsModel',
|
||||
'Settings/General/GeneralSettingsModel',
|
||||
'Settings/Naming/NamingView',
|
||||
'Settings/Naming/NamingModel',
|
||||
'Settings/Quality/QualityLayout',
|
||||
'Settings/Indexers/CollectionView',
|
||||
'Settings/Indexers/Collection',
|
||||
'Settings/DownloadClient/DownloadClientView',
|
||||
'Settings/Notifications/CollectionView',
|
||||
'Settings/Notifications/Collection',
|
||||
'Settings/General/GeneralView',
|
||||
'Settings/Misc/MiscView'
|
||||
],
|
||||
function (App, Marionette, SettingsModel, GeneralSettingsModel, NamingView, NamingModel, QualityLayout, IndexerCollectionView, IndexerCollection, DownloadClientView, NotificationCollectionView, NotificationCollection, GeneralView, MiscView) {
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'marionette',
|
||||
'Settings/SettingsModel',
|
||||
'Settings/General/GeneralSettingsModel',
|
||||
'Settings/Naming/NamingModel',
|
||||
'Settings/Naming/NamingView',
|
||||
'Settings/Quality/QualityLayout',
|
||||
'Settings/Indexers/CollectionView',
|
||||
'Settings/Indexers/Collection',
|
||||
'Settings/DownloadClient/DownloadClientView',
|
||||
'Settings/Notifications/CollectionView',
|
||||
'Settings/Notifications/Collection',
|
||||
'Settings/General/GeneralView',
|
||||
'Settings/Misc/MiscView'
|
||||
], function (App, Marionette, SettingsModel, GeneralSettingsModel,NamingModel, NamingView, QualityLayout, IndexerCollectionView, IndexerCollection, DownloadClientView,
|
||||
NotificationCollectionView, NotificationCollection, GeneralView, MiscView) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Settings/SettingsLayoutTemplate',
|
||||
|
||||
|
@ -56,7 +57,7 @@ define([
|
|||
}
|
||||
|
||||
this.ui.namingTab.tab('show');
|
||||
App.Router.navigate('settings/naming');
|
||||
this._navigate('settings/naming');
|
||||
},
|
||||
|
||||
showQuality: function (e) {
|
||||
|
@ -65,7 +66,7 @@ define([
|
|||
}
|
||||
|
||||
this.ui.qualityTab.tab('show');
|
||||
App.Router.navigate('settings/quality');
|
||||
this._navigate('settings/quality');
|
||||
},
|
||||
|
||||
showIndexers: function (e) {
|
||||
|
@ -74,7 +75,7 @@ define([
|
|||
}
|
||||
|
||||
this.ui.indexersTab.tab('show');
|
||||
App.Router.navigate('settings/indexers');
|
||||
this._navigate('settings/indexers');
|
||||
},
|
||||
|
||||
showDownloadClient: function (e) {
|
||||
|
@ -83,7 +84,7 @@ define([
|
|||
}
|
||||
|
||||
this.ui.downloadClientTab.tab('show');
|
||||
App.Router.navigate('settings/downloadclient');
|
||||
this._navigate('settings/downloadclient');
|
||||
},
|
||||
|
||||
showNotifications: function (e) {
|
||||
|
@ -92,7 +93,7 @@ define([
|
|||
}
|
||||
|
||||
this.ui.notificationsTab.tab('show');
|
||||
App.Router.navigate('settings/notifications');
|
||||
this._navigate('settings/notifications');
|
||||
},
|
||||
|
||||
showGeneral: function (e) {
|
||||
|
@ -101,7 +102,7 @@ define([
|
|||
}
|
||||
|
||||
this.ui.generalTab.tab('show');
|
||||
App.Router.navigate('settings/general');
|
||||
this._navigate('settings/general');
|
||||
},
|
||||
|
||||
showMisc: function (e) {
|
||||
|
@ -110,7 +111,13 @@ define([
|
|||
}
|
||||
|
||||
this.ui.miscTab.tab('show');
|
||||
App.Router.navigate('settings/misc');
|
||||
this._navigate('settings/misc');
|
||||
},
|
||||
|
||||
_navigate:function(route){
|
||||
require(['Router'], function(){
|
||||
App.Router.navigate(route);
|
||||
});
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
'use strict';
|
||||
'use strict';
|
||||
define(['app',
|
||||
'Settings/SettingsModelBase'], function (App, SettingsModelBase) {
|
||||
return SettingsModelBase.extend({
|
||||
url : App.Constants.ApiRoot + '/settings',
|
||||
url : window.ApiRoot + '/settings',
|
||||
successMessage: 'Settings saved',
|
||||
errorMessage : 'Failed to save settings'
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue