From b70906f5e95d8d628f3d0e065416414488cccb29 Mon Sep 17 00:00:00 2001 From: Christian Hofmaier Date: Mon, 19 Oct 2020 19:40:32 +0200 Subject: [locationinfo] real fix of bootstrap switches --- .../templates/page-config-panel-default.html | 26 +++------------------- 1 file 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 () { -- cgit v1.2.3-55-g7522