download client settings only shows config for the selected client.

pull/4/head
kay.one 12 years ago
parent 2a1f9500eb
commit 0779ff63d4

@ -4,7 +4,7 @@
<option name="myLocal" value="false" />
<inspection_tool class="AssignmentResultUsedJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AssignmentToForLoopParameterJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="AssignmentToFunctionParameterJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="AssignmentToFunctionParameterJS" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="ChainedEqualityJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CheckEmptyScriptTag" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConditionalExpressionWithIdenticalBranchesJS" enabled="true" level="ERROR" enabled_by_default="true" />

@ -5,7 +5,7 @@
<label class="control-label">Download Client</label>
<div class="controls">
<select class="inputClass x-backlog-setting" name="downloadClient">
<select class="inputClass x-download-client" name="downloadClient">
<option value="0">SABnzbd</option>
<option value="1">Blackhole</option>
<option value="2">Pneumatic</option>
@ -41,7 +41,7 @@
</div>
</fieldset>
<fieldset>
<fieldset class="x-sab-config">
<legend>SABnzbd</legend>
<div class="control-group">
@ -170,7 +170,7 @@
</div>
</fieldset>
<fieldset>
<fieldset class="x-blackhole-config">
<legend>Blackhole</legend>
<div class="control-group">
<label class="control-label">Blackhole Directory</label>
@ -184,7 +184,7 @@
</div>
</fieldset>
<fieldset>
<fieldset class="x-pneumatic-config">
<legend>Pneumatic</legend>
<div class="control-group">
<label class="control-label">Nzb Directory</label>
@ -198,7 +198,7 @@
</div>
</fieldset>
<fieldset>
<fieldset class="x-nzbget-config">
<legend>NZBGet</legend>
<div class="control-group">
<label class="control-label">Host</label>

@ -10,16 +10,76 @@ define([
className: 'form-horizontal',
ui: {
switch : '.switch',
tooltip : '[class^="help-inline"] i',
pathInput: '.x-path'
switch : '.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'
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
this.ui.switch.bootstrapSwitch();
this.ui.tooltip.tooltip({ placement: 'right', html: true });
this.ui.pathInput.autoComplete('/directories');
this.refreshUIVisibility(this.model.get('downloadClient'));
},
downloadClientChanged: function () {
var clientId = this.ui.downloadClientSelect.val();
this.refreshUIVisibility(clientId);
},
refreshUIVisibility: function (clientId) {
if (!clientId) {
clientId = "0";
}
switch (clientId.toString()) {
case "0":
this.ui.sabConfig.show();
this.ui.blackholeConfig.hide();
this.ui.pneumaticConfig.hide();
this.ui.nzbGetConfig.hide();
break;
case "1":
this.ui.sabConfig.hide();
this.ui.blackholeConfig.show();
this.ui.pneumaticConfig.hide();
this.ui.nzbGetConfig.hide();
break;
case "2":
this.ui.sabConfig.hide();
this.ui.blackholeConfig.hide();
this.ui.pneumaticConfig.show();
this.ui.nzbGetConfig.hide();
break;
case "3":
this.ui.sabConfig.hide();
this.ui.blackholeConfig.hide();
this.ui.pneumaticConfig.hide();
this.ui.nzbGetConfig.show();
break;
default :
throw "unknown download client id" + clientId;
}
}
});
});

Loading…
Cancel
Save