Frontend form and marionette modifications to allow static hosts and locations

This commit is contained in:
Nikolaj Frey
2020-08-14 15:01:09 +10:00
parent 1c302c6842
commit 37cb63b2d4
8 changed files with 105 additions and 19 deletions

View File

@@ -22,6 +22,9 @@ module.exports = Mn.View.extend({
form: 'form',
domain_names: 'input[name="domain_names"]',
forward_host: 'input[name="forward_host"]',
root_dir: 'input[name="root_dir"]',
index_file: 'input[name="index_file"]',
static: 'input[type="checkbox"].static-checkbox',
buttons: '.modal-footer button',
cancel: 'button.cancel',
save: 'button.save',
@@ -42,6 +45,20 @@ module.exports = Mn.View.extend({
},
events: {
'click @ui.static': function(e){
const map = {};
let value = e.target.value
if(e.target.type == 'checkbox') value = e.target.checked
map[e.target.name] = value
this.model.set(map);
setTimeout(this.render.bind(this), 300)
},
'change @ui.certificate_select': function () {
let id = this.ui.certificate_select.val();
if (id === 'new') {
@@ -128,7 +145,8 @@ module.exports = Mn.View.extend({
data.hsts_enabled = !!data.hsts_enabled;
data.hsts_subdomains = !!data.hsts_subdomains;
data.ssl_forced = !!data.ssl_forced;
data.static = !!data.static;
if (typeof data.domain_names === 'string' && data.domain_names) {
data.domain_names = data.domain_names.split(',');
}