sonarr-repo-only/UI/Settings/General/GeneralView.js

62 lines
1.6 KiB
JavaScript
Raw Normal View History

'use strict';
2013-07-14 07:00:50 +00:00
define(
[
'marionette',
'Mixins/AsModelBoundView'
], function (Marionette, AsModelBoundView) {
var view = Marionette.ItemView.extend({
2013-09-25 04:51:44 +00:00
template: 'Settings/General/GeneralTemplate',
events: {
'change .x-auth': '_setAuthOptionsVisibility',
'change .x-ssl': '_setSslOptionsVisibility'
},
ui: {
authToggle : '.x-auth',
authOptions: '.x-auth-options',
sslToggle : '.x-ssl',
sslOptions: '.x-ssl-options'
},
onRender: function(){
if(!this.ui.authToggle.prop('checked')){
this.ui.authOptions.hide();
}
2013-07-14 07:00:50 +00:00
2013-09-25 04:51:44 +00:00
if(!this.ui.sslToggle.prop('checked')){
this.ui.sslOptions.hide();
}
},
2013-07-14 07:00:50 +00:00
2013-09-25 04:51:44 +00:00
_setAuthOptionsVisibility: function () {
2013-07-14 07:00:50 +00:00
2013-09-25 04:51:44 +00:00
var showAuthOptions = this.ui.authToggle.prop('checked');
2013-07-14 07:00:50 +00:00
2013-09-25 04:51:44 +00:00
if (showAuthOptions) {
this.ui.authOptions.slideDown();
}
2013-07-14 07:00:50 +00:00
2013-09-25 04:51:44 +00:00
else {
this.ui.authOptions.slideUp();
}
},
2013-07-14 07:00:50 +00:00
2013-09-25 04:51:44 +00:00
_setSslOptionsVisibility: function () {
2013-07-14 07:00:50 +00:00
2013-09-25 04:51:44 +00:00
var showSslOptions = this.ui.sslToggle.prop('checked');
2013-07-14 07:00:50 +00:00
2013-09-25 04:51:44 +00:00
if (showSslOptions) {
this.ui.sslOptions.slideDown();
2013-07-14 07:00:50 +00:00
}
2013-09-25 04:51:44 +00:00
else {
this.ui.sslOptions.slideUp();
}
}
});
2013-07-14 07:00:50 +00:00
return AsModelBoundView.call(view);
});