From d906a010028fef4592ea77ea27907ab32effd9ba Mon Sep 17 00:00:00 2001 From: sunnavy Date: Fri, 20 Dec 2024 17:11:09 -0500 Subject: [PATCH] Migrate bootstrap-select's remnants to tom-select --- share/html/Admin/Elements/AddCustomFieldValue | 2 +- share/html/Admin/Lifecycles/Mappings.html | 6 ++---- share/html/Admin/Users/index.html | 8 ++++++-- share/html/Elements/AuthToken/Create | 9 ++++++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/share/html/Admin/Elements/AddCustomFieldValue b/share/html/Admin/Elements/AddCustomFieldValue index 6cf22e68176..0bd442571f7 100644 --- a/share/html/Admin/Elements/AddCustomFieldValue +++ b/share/html/Admin/Elements/AddCustomFieldValue @@ -120,7 +120,7 @@ jQuery( function() { jQuery('input[name=CustomField-<% $CustomField->id %>-Value-new-Name]').val('').focus(), jQuery('input[name=CustomField-<% $CustomField->id %>-Value-new-Description]').val(''), jQuery('[name=CustomField-<% $CustomField->id %>-Value-new-Category]').val(''); - jQuery('form[name=AddCustomFieldValue] select.selectpicker, div.edit_custom_field_values select.selectpicker').selectpicker('refresh'); + initializeSelectElements(document.querySelector('div.edit_custom_field_values')); } else { alert(data.message); diff --git a/share/html/Admin/Lifecycles/Mappings.html b/share/html/Admin/Lifecycles/Mappings.html index d7d2201cd26..7a65977fb03 100644 --- a/share/html/Admin/Lifecycles/Mappings.html +++ b/share/html/Admin/Lifecycles/Mappings.html @@ -117,10 +117,8 @@
<&|/l, $LifecycleObj->Name, $Other->Name &>From [_1 const from = select.attr('name').replace(/map-.*--(.*)--.*/, '$1').toLowerCase(); select.find('option').each(function() { if ( jQuery(this).attr('value').toLowerCase() === from ) { - select.val(jQuery(this).attr('value')); - select.selectpicker('refresh'); - return false; - } + select.get(0).tomselect.setValue(jQuery(this).attr('value')); + } }); } }); diff --git a/share/html/Admin/Users/index.html b/share/html/Admin/Users/index.html index bde86f20e43..e428b243777 100644 --- a/share/html/Admin/Users/index.html +++ b/share/html/Admin/Users/index.html @@ -173,19 +173,23 @@ } new_operator.attr('name', jQuery(this).attr('name').replace(/Field/, 'Op')); + new_operator.get(0).tomselect?.destroy(); + new_operator.removeClass('tomselected ts-hidden-accessible'); + new_value.attr('name', jQuery(this).attr('name').replace(/Field/, 'String')); + new_value.get(0).tomselect?.destroy(); + new_value.removeClass('tomselected ts-hidden-accessible'); row.children('div.operator').children().remove(); row.children('div.operator').append(new_operator); - row.children('div.operator').find('select.selectpicker').selectpicker(); row.children('div.value').children().remove(); row.children('div.value').append(new_value); - row.children('div.value').find('select.selectpicker').selectpicker(); if ( new_value.hasClass('datepicker') ) { new_value.removeClass('hasDatepicker'); initDatePicker(row); } + initializeSelectElements(row.get(0)); }); % for my $suffix ( '', 2 .. 3 ) { diff --git a/share/html/Elements/AuthToken/Create b/share/html/Elements/AuthToken/Create index d0db03cac41..9b719f90340 100644 --- a/share/html/Elements/AuthToken/Create +++ b/share/html/Elements/AuthToken/Create @@ -153,12 +153,15 @@ // set back to default value expiresSelect.val("1M"); - jQuery(".selectpicker").selectpicker("refresh"); } expiresSelect.prop( "disabled", disable ); - - jQuery(".selectpicker").selectpicker("refresh"); + if (disable) { + expiresSelect.get(0).tomselect?.disable(); + } + else { + expiresSelect.get(0).tomselect?.enable(); + } onExpiresSelectChange(); } );