Files
Prowlarr-Prowlarr/src/UI/Settings/DownloadClient/DownloadHandling/DownloadHandlingView.js
Keivan Beigi 0ee5261a2a stripBom
2015-01-29 18:10:16 -08:00

61 lines
2.2 KiB
JavaScript

'use strict';
define(
[
'marionette',
'Mixins/AsModelBoundView',
'Mixins/AsValidatedView'
], function (Marionette, AsModelBoundView, AsValidatedView) {
var view = Marionette.ItemView.extend({
template: 'Settings/DownloadClient/DownloadHandling/DownloadHandlingViewTemplate',
ui: {
completedDownloadHandlingCheckbox : '.x-completed-download-handling',
completedDownloadOptions : '.x-completed-download-options',
failedAutoRedownladCheckbox : '.x-failed-auto-redownload',
failedDownloadOptions : '.x-failed-download-options'
},
events: {
'change .x-completed-download-handling' : '_setCompletedDownloadOptionsVisibility',
'change .x-failed-auto-redownload' : '_setFailedDownloadOptionsVisibility'
},
onRender: function () {
if (!this.ui.completedDownloadHandlingCheckbox.prop('checked')) {
this.ui.completedDownloadOptions.hide();
}
if (!this.ui.failedAutoRedownladCheckbox.prop('checked')) {
this.ui.failedDownloadOptions.hide();
}
},
_setCompletedDownloadOptionsVisibility: function () {
var checked = this.ui.completedDownloadHandlingCheckbox.prop('checked');
if (checked) {
this.ui.completedDownloadOptions.slideDown();
}
else {
this.ui.completedDownloadOptions.slideUp();
}
},
_setFailedDownloadOptionsVisibility: function () {
var checked = this.ui.failedAutoRedownladCheckbox.prop('checked');
if (checked) {
this.ui.failedDownloadOptions.slideDown();
}
else {
this.ui.failedDownloadOptions.slideUp();
}
}
});
AsModelBoundView.call(view);
AsValidatedView.call(view);
return view;
});