|
|
@ -24,8 +24,9 @@ var LoadingView = require('../Shared/LoadingView');
|
|
|
|
var Config = require('../Config');
|
|
|
|
var Config = require('../Config');
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = Marionette.Layout.extend({
|
|
|
|
module.exports = Marionette.Layout.extend({
|
|
|
|
template : 'Settings/SettingsLayoutTemplate',
|
|
|
|
template : 'Settings/SettingsLayoutTemplate',
|
|
|
|
regions : {
|
|
|
|
|
|
|
|
|
|
|
|
regions : {
|
|
|
|
mediaManagement : '#media-management',
|
|
|
|
mediaManagement : '#media-management',
|
|
|
|
profiles : '#profiles',
|
|
|
|
profiles : '#profiles',
|
|
|
|
quality : '#quality',
|
|
|
|
quality : '#quality',
|
|
|
@ -37,7 +38,8 @@ module.exports = Marionette.Layout.extend({
|
|
|
|
uiRegion : '#ui',
|
|
|
|
uiRegion : '#ui',
|
|
|
|
loading : '#loading-region'
|
|
|
|
loading : '#loading-region'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ui : {
|
|
|
|
|
|
|
|
|
|
|
|
ui : {
|
|
|
|
mediaManagementTab : '.x-media-management-tab',
|
|
|
|
mediaManagementTab : '.x-media-management-tab',
|
|
|
|
profilesTab : '.x-profiles-tab',
|
|
|
|
profilesTab : '.x-profiles-tab',
|
|
|
|
qualityTab : '.x-quality-tab',
|
|
|
|
qualityTab : '.x-quality-tab',
|
|
|
@ -49,28 +51,33 @@ module.exports = Marionette.Layout.extend({
|
|
|
|
uiTab : '.x-ui-tab',
|
|
|
|
uiTab : '.x-ui-tab',
|
|
|
|
advancedSettings : '.x-advanced-settings'
|
|
|
|
advancedSettings : '.x-advanced-settings'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
events : {
|
|
|
|
|
|
|
|
"click .x-media-management-tab" : '_showMediaManagement',
|
|
|
|
events : {
|
|
|
|
"click .x-profiles-tab" : '_showProfiles',
|
|
|
|
'click .x-media-management-tab' : '_showMediaManagement',
|
|
|
|
"click .x-quality-tab" : '_showQuality',
|
|
|
|
'click .x-profiles-tab' : '_showProfiles',
|
|
|
|
"click .x-indexers-tab" : '_showIndexers',
|
|
|
|
'click .x-quality-tab' : '_showQuality',
|
|
|
|
"click .x-download-client-tab" : '_showDownloadClient',
|
|
|
|
'click .x-indexers-tab' : '_showIndexers',
|
|
|
|
"click .x-notifications-tab" : '_showNotifications',
|
|
|
|
'click .x-download-client-tab' : '_showDownloadClient',
|
|
|
|
"click .x-metadata-tab" : '_showMetadata',
|
|
|
|
'click .x-notifications-tab' : '_showNotifications',
|
|
|
|
"click .x-general-tab" : '_showGeneral',
|
|
|
|
'click .x-metadata-tab' : '_showMetadata',
|
|
|
|
"click .x-ui-tab" : '_showUi',
|
|
|
|
'click .x-general-tab' : '_showGeneral',
|
|
|
|
"click .x-save-settings" : '_save',
|
|
|
|
'click .x-ui-tab' : '_showUi',
|
|
|
|
"change .x-advanced-settings" : '_toggleAdvancedSettings'
|
|
|
|
'click .x-save-settings' : '_save',
|
|
|
|
},
|
|
|
|
'change .x-advanced-settings' : '_toggleAdvancedSettings'
|
|
|
|
initialize : function(options){
|
|
|
|
},
|
|
|
|
if(options.action) {
|
|
|
|
|
|
|
|
|
|
|
|
initialize : function(options) {
|
|
|
|
|
|
|
|
if (options.action) {
|
|
|
|
this.action = options.action.toLowerCase();
|
|
|
|
this.action = options.action.toLowerCase();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.listenTo(vent, vent.Hotkeys.SaveSettings, this._save);
|
|
|
|
this.listenTo(vent, vent.Hotkeys.SaveSettings, this._save);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onRender : function(){
|
|
|
|
|
|
|
|
|
|
|
|
onRender : function() {
|
|
|
|
this.loading.show(new LoadingView());
|
|
|
|
this.loading.show(new LoadingView());
|
|
|
|
var self = this;
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
|
|
this.mediaManagementSettings = new MediaManagementSettingsModel();
|
|
|
|
this.mediaManagementSettings = new MediaManagementSettingsModel();
|
|
|
|
this.namingSettings = new NamingModel();
|
|
|
|
this.namingSettings = new NamingModel();
|
|
|
|
this.indexerSettings = new IndexerSettingsModel();
|
|
|
|
this.indexerSettings = new IndexerSettingsModel();
|
|
|
@ -78,26 +85,29 @@ module.exports = Marionette.Layout.extend({
|
|
|
|
this.notificationCollection = new NotificationCollection();
|
|
|
|
this.notificationCollection = new NotificationCollection();
|
|
|
|
this.generalSettings = new GeneralSettingsModel();
|
|
|
|
this.generalSettings = new GeneralSettingsModel();
|
|
|
|
this.uiSettings = new UiSettingsModel();
|
|
|
|
this.uiSettings = new UiSettingsModel();
|
|
|
|
Backbone.$.when(this.mediaManagementSettings.fetch(), this.namingSettings.fetch(), this.indexerSettings.fetch(), this.downloadClientSettings.fetch(), this.notificationCollection.fetch(), this.generalSettings.fetch(), this.uiSettings.fetch()).done(function(){
|
|
|
|
Backbone.$.when(this.mediaManagementSettings.fetch(), this.namingSettings.fetch(), this.indexerSettings.fetch(), this.downloadClientSettings.fetch(),
|
|
|
|
if(!self.isClosed) {
|
|
|
|
this.notificationCollection.fetch(), this.generalSettings.fetch(), this.uiSettings.fetch()).done(function() {
|
|
|
|
self.loading.$el.hide();
|
|
|
|
if (!self.isClosed) {
|
|
|
|
self.mediaManagement.show(new MediaManagementLayout({
|
|
|
|
self.loading.$el.hide();
|
|
|
|
settings : self.mediaManagementSettings,
|
|
|
|
self.mediaManagement.show(new MediaManagementLayout({
|
|
|
|
namingSettings : self.namingSettings
|
|
|
|
settings : self.mediaManagementSettings,
|
|
|
|
}));
|
|
|
|
namingSettings : self.namingSettings
|
|
|
|
self.profiles.show(new ProfileLayout());
|
|
|
|
}));
|
|
|
|
self.quality.show(new QualityLayout());
|
|
|
|
self.profiles.show(new ProfileLayout());
|
|
|
|
self.indexers.show(new IndexerLayout({model : self.indexerSettings}));
|
|
|
|
self.quality.show(new QualityLayout());
|
|
|
|
self.downloadClient.show(new DownloadClientLayout({model : self.downloadClientSettings}));
|
|
|
|
self.indexers.show(new IndexerLayout({ model : self.indexerSettings }));
|
|
|
|
self.notifications.show(new NotificationCollectionView({collection : self.notificationCollection}));
|
|
|
|
self.downloadClient.show(new DownloadClientLayout({ model : self.downloadClientSettings }));
|
|
|
|
self.metadata.show(new MetadataLayout());
|
|
|
|
self.notifications.show(new NotificationCollectionView({ collection : self.notificationCollection }));
|
|
|
|
self.general.show(new GeneralView({model : self.generalSettings}));
|
|
|
|
self.metadata.show(new MetadataLayout());
|
|
|
|
self.uiRegion.show(new UiView({model : self.uiSettings}));
|
|
|
|
self.general.show(new GeneralView({ model : self.generalSettings }));
|
|
|
|
}
|
|
|
|
self.uiRegion.show(new UiView({ model : self.uiSettings }));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this._setAdvancedSettingsState();
|
|
|
|
this._setAdvancedSettingsState();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onShow : function(){
|
|
|
|
|
|
|
|
|
|
|
|
onShow : function() {
|
|
|
|
switch (this.action) {
|
|
|
|
switch (this.action) {
|
|
|
|
case 'profiles':
|
|
|
|
case 'profiles':
|
|
|
|
this._showProfiles();
|
|
|
|
this._showProfiles();
|
|
|
@ -130,92 +140,112 @@ module.exports = Marionette.Layout.extend({
|
|
|
|
this._showMediaManagement();
|
|
|
|
this._showMediaManagement();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_showMediaManagement : function(e){
|
|
|
|
|
|
|
|
if(e) {
|
|
|
|
_showMediaManagement : function(e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.mediaManagementTab.tab('show');
|
|
|
|
this.ui.mediaManagementTab.tab('show');
|
|
|
|
this._navigate('settings/mediamanagement');
|
|
|
|
this._navigate('settings/mediamanagement');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_showProfiles : function(e){
|
|
|
|
|
|
|
|
if(e) {
|
|
|
|
_showProfiles : function(e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.profilesTab.tab('show');
|
|
|
|
this.ui.profilesTab.tab('show');
|
|
|
|
this._navigate('settings/profiles');
|
|
|
|
this._navigate('settings/profiles');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_showQuality : function(e){
|
|
|
|
|
|
|
|
if(e) {
|
|
|
|
_showQuality : function(e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.qualityTab.tab('show');
|
|
|
|
this.ui.qualityTab.tab('show');
|
|
|
|
this._navigate('settings/quality');
|
|
|
|
this._navigate('settings/quality');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_showIndexers : function(e){
|
|
|
|
|
|
|
|
if(e) {
|
|
|
|
_showIndexers : function(e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.indexersTab.tab('show');
|
|
|
|
this.ui.indexersTab.tab('show');
|
|
|
|
this._navigate('settings/indexers');
|
|
|
|
this._navigate('settings/indexers');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_showDownloadClient : function(e){
|
|
|
|
|
|
|
|
if(e) {
|
|
|
|
_showDownloadClient : function(e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.downloadClientTab.tab('show');
|
|
|
|
this.ui.downloadClientTab.tab('show');
|
|
|
|
this._navigate('settings/downloadclient');
|
|
|
|
this._navigate('settings/downloadclient');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_showNotifications : function(e){
|
|
|
|
|
|
|
|
if(e) {
|
|
|
|
_showNotifications : function(e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.notificationsTab.tab('show');
|
|
|
|
this.ui.notificationsTab.tab('show');
|
|
|
|
this._navigate('settings/connect');
|
|
|
|
this._navigate('settings/connect');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_showMetadata : function(e){
|
|
|
|
|
|
|
|
if(e) {
|
|
|
|
_showMetadata : function(e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.ui.metadataTab.tab('show');
|
|
|
|
this.ui.metadataTab.tab('show');
|
|
|
|
this._navigate('settings/metadata');
|
|
|
|
this._navigate('settings/metadata');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_showGeneral : function(e){
|
|
|
|
|
|
|
|
if(e) {
|
|
|
|
_showGeneral : function(e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.ui.generalTab.tab('show');
|
|
|
|
this.ui.generalTab.tab('show');
|
|
|
|
this._navigate('settings/general');
|
|
|
|
this._navigate('settings/general');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_showUi : function(e){
|
|
|
|
|
|
|
|
if(e) {
|
|
|
|
_showUi : function(e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.ui.uiTab.tab('show');
|
|
|
|
this.ui.uiTab.tab('show');
|
|
|
|
this._navigate('settings/ui');
|
|
|
|
this._navigate('settings/ui');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_navigate : function(route){
|
|
|
|
|
|
|
|
|
|
|
|
_navigate : function(route) {
|
|
|
|
Backbone.history.navigate(route, {
|
|
|
|
Backbone.history.navigate(route, {
|
|
|
|
trigger : false,
|
|
|
|
trigger : false,
|
|
|
|
replace : true
|
|
|
|
replace : true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_save : function(){
|
|
|
|
|
|
|
|
|
|
|
|
_save : function() {
|
|
|
|
vent.trigger(vent.Commands.SaveSettings);
|
|
|
|
vent.trigger(vent.Commands.SaveSettings);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_setAdvancedSettingsState : function(){
|
|
|
|
|
|
|
|
|
|
|
|
_setAdvancedSettingsState : function() {
|
|
|
|
var checked = Config.getValueBoolean(Config.Keys.AdvancedSettings);
|
|
|
|
var checked = Config.getValueBoolean(Config.Keys.AdvancedSettings);
|
|
|
|
this.ui.advancedSettings.prop('checked', checked);
|
|
|
|
this.ui.advancedSettings.prop('checked', checked);
|
|
|
|
if(checked) {
|
|
|
|
|
|
|
|
|
|
|
|
if (checked) {
|
|
|
|
$('body').addClass('show-advanced-settings');
|
|
|
|
$('body').addClass('show-advanced-settings');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_toggleAdvancedSettings : function(){
|
|
|
|
|
|
|
|
|
|
|
|
_toggleAdvancedSettings : function() {
|
|
|
|
var checked = this.ui.advancedSettings.prop('checked');
|
|
|
|
var checked = this.ui.advancedSettings.prop('checked');
|
|
|
|
Config.setValue(Config.Keys.AdvancedSettings, checked);
|
|
|
|
Config.setValue(Config.Keys.AdvancedSettings, checked);
|
|
|
|
if(checked) {
|
|
|
|
|
|
|
|
|
|
|
|
if (checked) {
|
|
|
|
$('body').addClass('show-advanced-settings');
|
|
|
|
$('body').addClass('show-advanced-settings');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
$('body').removeClass('show-advanced-settings');
|
|
|
|
$('body').removeClass('show-advanced-settings');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|