add basic/advanced switcher for installation-mode

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-05-13 15:15:20 +02:00
parent 7e14e9edd7
commit fb38e0e21d
4 changed files with 31 additions and 1 deletions

View File

@@ -35,7 +35,17 @@
<div class="card-body p-5">
<form method="post" action="?step={{ setup.step }}">
{% if setup.step > 0 %}
<h4 class="mb-3">{{ section.title }}</h4>
<div class="row">
<div class="col-12 col-md-7 order-2 order-md-1">
<h4 class="mb-3">{{ section.title }}</h4>
</div>
<div class="col-12 col-md-5 order-1 order-md-2">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="switchInstallMode" {% if extended is defined and extended %}checked{% endif %}>
<label class="form-check-label" for="switchInstallMode">{% if extended is defined and extended %}{{ lng('install.switchmode_basic') }}{% else %}{{ lng('install.switchmode_advanced') }}{% endif %}</label>
</div>
</div>
</div>
<p class="lead">{{ section.description }}</p>
<hr />

View File

@@ -0,0 +1,17 @@
$(function () {
/*
* switch between basic and advanced install mode
*/
$('#switchInstallMode').on('click', function () {
var checked = $(this).prop('checked');
window.location = '/install/install.php' + replaceQueryParam('extended', +checked, window.location.search);
});
function replaceQueryParam(param, newval, search) {
var regex = new RegExp("([?;&])" + param + "[^&;]*[;&]?");
if (search.match(regex)) {
search = search.replace(regex, "$1").replace(/&$/, '');
}
return search + '&' + param + '=' + newval;
}
});

View File

@@ -21,3 +21,4 @@ require('./components/ipsandports')
require('./components/domains')
require('./components/configfiles')
require('./components/apikeys')
require('./components/install')