2013-03-04 01:09:43 +01:00
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
define([
|
2013-03-30 00:28:58 +01:00
|
|
|
|
'app', 'Settings/SettingsModel'
|
2013-03-04 01:09:43 +01:00
|
|
|
|
|
|
|
|
|
], function () {
|
|
|
|
|
|
|
|
|
|
NzbDrone.Settings.DownloadClient.DownloadClientView = Backbone.Marionette.ItemView.extend({
|
2013-03-30 00:28:58 +01:00
|
|
|
|
template : 'Settings/DownloadClient/DownloadClientTemplate',
|
2013-03-14 01:26:30 +01:00
|
|
|
|
className: 'form-horizontal',
|
|
|
|
|
|
|
|
|
|
ui: {
|
2013-04-19 02:53:02 +02:00
|
|
|
|
bsSwitch : '.switch',
|
2013-04-01 09:24:18 +02:00
|
|
|
|
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'
|
2013-03-14 01:26:30 +01:00
|
|
|
|
},
|
2013-03-04 01:09:43 +01:00
|
|
|
|
|
|
|
|
|
onRender: function () {
|
2013-03-14 01:26:30 +01:00
|
|
|
|
this.ui.tooltip.tooltip({ placement: 'right', html: true });
|
2013-03-16 01:33:04 +01:00
|
|
|
|
this.ui.pathInput.autoComplete('/directories');
|
2013-04-01 09:24:18 +02:00
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
2013-03-04 01:09:43 +01:00
|
|
|
|
}
|
2013-04-01 09:24:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-04 01:09:43 +01:00
|
|
|
|
});
|
|
|
|
|
});
|