mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 17:13:49 -07:00
Settings loading overhaul
Download client moved to a layout Settings are only shown after all settings are loaded
This commit is contained in:
parent
29ed3293d1
commit
b21e49f5fa
16 changed files with 443 additions and 372 deletions
74
UI/Settings/DownloadClient/Layout.js
Normal file
74
UI/Settings/DownloadClient/Layout.js
Normal file
|
@ -0,0 +1,74 @@
|
|||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Settings/DownloadClient/SabView',
|
||||
'Settings/DownloadClient/BlackholeView',
|
||||
'Settings/DownloadClient/PneumaticView',
|
||||
'Settings/DownloadClient/NzbgetView',
|
||||
'Mixins/AsModelBoundView',
|
||||
'bootstrap'
|
||||
], function (Marionette, SabView, BlackholeView, PneumaticView, NzbgetView, AsModelBoundView) {
|
||||
|
||||
var view = Marionette.Layout.extend({
|
||||
template : 'Settings/DownloadClient/LayoutTemplate',
|
||||
|
||||
regions: {
|
||||
downloadClient: '#download-client-settings-region'
|
||||
},
|
||||
|
||||
ui: {
|
||||
downloadClientSelect: '.x-download-client'
|
||||
},
|
||||
|
||||
events: {
|
||||
'change .x-download-client': 'downloadClientChanged'
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.sabView = new SabView({ model: this.model});
|
||||
this.blackholeView = new BlackholeView({ model: this.model});
|
||||
this.pneumaticView = new PneumaticView({ model: this.model});
|
||||
this.nzbgetView = new NzbgetView({ model: this.model});
|
||||
|
||||
var client = this.model.get('downloadClient');
|
||||
this.refreshUIVisibility(client);
|
||||
},
|
||||
|
||||
downloadClientChanged: function () {
|
||||
var clientId = this.ui.downloadClientSelect.val();
|
||||
this.refreshUIVisibility(clientId);
|
||||
},
|
||||
|
||||
refreshUIVisibility: function (clientId) {
|
||||
|
||||
if (!clientId) {
|
||||
clientId = 'sabnzbd';
|
||||
}
|
||||
|
||||
switch (clientId.toString()) {
|
||||
case 'sabnzbd':
|
||||
this.downloadClient.show(this.sabView);
|
||||
break;
|
||||
|
||||
case 'blackhole':
|
||||
this.downloadClient.show(this.blackholeView);
|
||||
break;
|
||||
|
||||
case 'pneumatic':
|
||||
this.downloadClient.show(this.pneumaticView);
|
||||
break;
|
||||
|
||||
case 'nzbget':
|
||||
this.downloadClient.show(this.nzbgetView);
|
||||
break;
|
||||
|
||||
default :
|
||||
throw 'unknown download client id' + clientId;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return AsModelBoundView.call(view);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue