summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Hofmaier2020-10-19 19:40:32 +0200
committerChristian Hofmaier2020-10-19 19:40:32 +0200
commitb70906f5e95d8d628f3d0e065416414488cccb29 (patch)
tree2712590857cd482f6e96ed2381a7db4de27e0581
parent[locationinfo] fix bootstrap-switches override always "on" (diff)
downloadslx-admin-b70906f5e95d8d628f3d0e065416414488cccb29.tar.gz
slx-admin-b70906f5e95d8d628f3d0e065416414488cccb29.tar.xz
slx-admin-b70906f5e95d8d628f3d0e065416414488cccb29.zip
[locationinfo] real fix of bootstrap switches
-rw-r--r--modules-available/locationinfo/templates/page-config-panel-default.html26
1 files changed, 3 insertions, 23 deletions
diff --git a/modules-available/locationinfo/templates/page-config-panel-default.html b/modules-available/locationinfo/templates/page-config-panel-default.html
index c502db4e..76e1f4a7 100644
--- a/modules-available/locationinfo/templates/page-config-panel-default.html
+++ b/modules-available/locationinfo/templates/page-config-panel-default.html
@@ -410,8 +410,7 @@ document.addEventListener("DOMContentLoaded", function () {
});
// Set state of input controls that aren't statically initialized server side
$('.modify-inputs input[type="checkbox"]')
- .bootstrapSwitch({size: 'small'})
- .on('switchChange.bootstrapSwitch', function () {
+ .on('click', function () {
if (this.name === 'scaledaysauto') {
$('#daystoshow').prop('disabled', this.checked);
}
@@ -501,10 +500,6 @@ document.addEventListener("DOMContentLoaded", function () {
var overVal = false;
if (overrides !== null && overrides[locId] !== undefined) overVal = true;
- // Make Bootstrap switches to normal checkboxes to be able to clone them correctly
- var btstrpCheckboxes = $('.modify-inputs input[class="btstrpCheckbox"]');
- btstrpCheckboxes.bootstrapSwitch('destroy');
-
// Clone needed content
var $contentCopy = $('#overridableConfigs').clone(true);
$contentCopy.closest('#overridableConfigs').prop('id', '');
@@ -541,19 +536,15 @@ document.addEventListener("DOMContentLoaded", function () {
$( this ).removeClass('btstrpCheckbox');
if ($( this ).attr('type') === 'range') $( this ).val(overVal ? overrides[locId][oldName] : $('#' + oldId).val());
else if ($( this ).attr('type') === 'checkbox') {
-
$( this )
- .bootstrapSwitch({size: 'small'})
- .on('switchChange.bootstrapSwitch', function () {
+ .on('click', function () {
var regex = RegExp('[a-b0-9]*scaledaysauto');
var substr = this.name.substring(0, this.name.length - 13);
if (regex.test(this.name)) {
$('#' + substr + 'daystoshow').prop('disabled', this.checked);
}
});
-
- // $( this ).bootstrapSwitch('state', overVal ? overrides[locId][oldName] : $('#' + oldId).val());
-
+ $( this ).prop('checked', overVal ? overrides[locId][oldName] : $('#' + oldId).prop('checked'));
}
});
@@ -569,17 +560,6 @@ document.addEventListener("DOMContentLoaded", function () {
// Call modeChange once to correctly show/hide fields
modeChange('override'+ locId + 'mode');
- // Recreate Bootstrap switches from checkboxes
- btstrpCheckboxes
- .bootstrapSwitch({size: 'small'})
- .on('switchChange.bootstrapSwitch', function () {
- var regex = RegExp('[a-b0-9]*scaledaysauto');
- var substr = this.name.substring(0, this.name.length - 13);
- if (regex.test(this.name)) {
- $('#' + substr + 'daystoshow').prop('disabled', this.checked);
- }
- });
-
// Add listener to range inputs for updating value text
var range = $('input[type="range"]');
range.change(function () {