mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Advanced settings!
SSL and branch
This commit is contained in:
parent
283cd36db8
commit
dc2af41e16
7 changed files with 237 additions and 101 deletions
|
@ -14,7 +14,8 @@ define(
|
|||
'Settings/Notifications/CollectionView',
|
||||
'Settings/Notifications/Collection',
|
||||
'Settings/General/GeneralView',
|
||||
'Shared/LoadingView'
|
||||
'Shared/LoadingView',
|
||||
'Config'
|
||||
], function (App,
|
||||
Marionette,
|
||||
SettingsModel,
|
||||
|
@ -28,7 +29,8 @@ define(
|
|||
NotificationCollectionView,
|
||||
NotificationCollection,
|
||||
GeneralView,
|
||||
LoadingView) {
|
||||
LoadingView,
|
||||
Config) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Settings/SettingsLayoutTemplate',
|
||||
|
||||
|
@ -48,7 +50,8 @@ define(
|
|||
indexersTab : '.x-indexers-tab',
|
||||
downloadClientTab : '.x-download-client-tab',
|
||||
notificationsTab : '.x-notifications-tab',
|
||||
generalTab : '.x-general-tab'
|
||||
generalTab : '.x-general-tab',
|
||||
advancedSettings : '.x-advanced-settings'
|
||||
},
|
||||
|
||||
events: {
|
||||
|
@ -58,7 +61,67 @@ define(
|
|||
'click .x-download-client-tab' : '_showDownloadClient',
|
||||
'click .x-notifications-tab' : '_showNotifications',
|
||||
'click .x-general-tab' : '_showGeneral',
|
||||
'click .x-save-settings' : '_save'
|
||||
'click .x-save-settings' : '_save',
|
||||
'change .x-advanced-settings' : '_toggleAdvancedSettings'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
if (options.action) {
|
||||
this.action = options.action.toLowerCase();
|
||||
}
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.loading.show(new LoadingView());
|
||||
var self = this;
|
||||
|
||||
this.settings = new SettingsModel();
|
||||
this.generalSettings = new GeneralSettingsModel();
|
||||
this.namingSettings = new NamingModel();
|
||||
this.indexerSettings = new IndexerCollection();
|
||||
this.notificationSettings = new NotificationCollection();
|
||||
|
||||
$.when(this.settings.fetch(),
|
||||
this.generalSettings.fetch(),
|
||||
this.namingSettings.fetch(),
|
||||
this.indexerSettings.fetch(),
|
||||
this.notificationSettings.fetch()
|
||||
).done(function () {
|
||||
self.loading.$el.hide();
|
||||
self.mediaManagement.show(new MediaManagementLayout({ settings: self.settings, namingSettings: self.namingSettings }));
|
||||
self.quality.show(new QualityLayout({ settings: self.settings }));
|
||||
self.indexers.show(new IndexerLayout({ settings: self.settings, indexersCollection: self.indexerSettings }));
|
||||
self.downloadClient.show(new DownloadClientLayout({ model: self.settings }));
|
||||
self.notifications.show(new NotificationCollectionView({ collection: self.notificationSettings }));
|
||||
self.general.show(new GeneralView({ model: self.generalSettings }));
|
||||
});
|
||||
|
||||
this._setAdvancedSettingsState();
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
switch (this.action) {
|
||||
case 'quality':
|
||||
this._showQuality();
|
||||
break;
|
||||
case 'indexers':
|
||||
this._showIndexers();
|
||||
break;
|
||||
case 'downloadclient':
|
||||
this._showDownloadClient();
|
||||
break;
|
||||
case 'connect':
|
||||
this._showNotifications();
|
||||
break;
|
||||
case 'notifications':
|
||||
this._showNotifications();
|
||||
break;
|
||||
case 'general':
|
||||
this._showGeneral();
|
||||
break;
|
||||
default:
|
||||
this._showMediaManagement();
|
||||
}
|
||||
},
|
||||
|
||||
_showMediaManagement: function (e) {
|
||||
|
@ -121,65 +184,30 @@ define(
|
|||
});
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
if (options.action) {
|
||||
this.action = options.action.toLowerCase();
|
||||
}
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.loading.show(new LoadingView());
|
||||
var self = this;
|
||||
|
||||
this.settings = new SettingsModel();
|
||||
this.generalSettings = new GeneralSettingsModel();
|
||||
this.namingSettings = new NamingModel();
|
||||
this.indexerSettings = new IndexerCollection();
|
||||
this.notificationSettings = new NotificationCollection();
|
||||
|
||||
$.when(this.settings.fetch(),
|
||||
this.generalSettings.fetch(),
|
||||
this.namingSettings.fetch(),
|
||||
this.indexerSettings.fetch(),
|
||||
this.notificationSettings.fetch()
|
||||
).done(function () {
|
||||
self.loading.$el.hide();
|
||||
self.mediaManagement.show(new MediaManagementLayout({ settings: self.settings, namingSettings: self.namingSettings }));
|
||||
self.quality.show(new QualityLayout({settings: self.settings}));
|
||||
self.indexers.show(new IndexerLayout({ settings: self.settings, indexersCollection: self.indexerSettings }));
|
||||
self.downloadClient.show(new DownloadClientLayout({model: self.settings}));
|
||||
self.notifications.show(new NotificationCollectionView({collection: self.notificationSettings}));
|
||||
self.general.show(new GeneralView({model: self.generalSettings}));
|
||||
});
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
switch (this.action) {
|
||||
case 'quality':
|
||||
this._showQuality();
|
||||
break;
|
||||
case 'indexers':
|
||||
this._showIndexers();
|
||||
break;
|
||||
case 'downloadclient':
|
||||
this._showDownloadClient();
|
||||
break;
|
||||
case 'connect':
|
||||
this._showNotifications();
|
||||
break;
|
||||
case 'notifications':
|
||||
this._showNotifications();
|
||||
break;
|
||||
case 'general':
|
||||
this._showGeneral();
|
||||
break;
|
||||
default:
|
||||
this._showMediaManagement();
|
||||
}
|
||||
},
|
||||
|
||||
_save: function () {
|
||||
App.vent.trigger(App.Commands.SaveSettings);
|
||||
},
|
||||
|
||||
_setAdvancedSettingsState: function () {
|
||||
var checked = Config.getValueBoolean('advancedSettings');
|
||||
this.ui.advancedSettings.prop('checked', checked);
|
||||
|
||||
if (checked) {
|
||||
this.$el.addClass('show-advanced-settings');
|
||||
}
|
||||
},
|
||||
|
||||
_toggleAdvancedSettings: function () {
|
||||
var checked = this.ui.advancedSettings.prop('checked');
|
||||
Config.setValue('advancedSettings', checked);
|
||||
|
||||
if (checked) {
|
||||
this.$el.addClass('show-advanced-settings');
|
||||
}
|
||||
|
||||
else {
|
||||
this.$el.removeClass('show-advanced-settings');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue