Skip to content

Commit

Permalink
Migrate bootstrap-select's remnants to tom-select
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnavy committed Dec 20, 2024
1 parent 27442d0 commit d906a01
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion share/html/Admin/Elements/AddCustomFieldValue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 2 additions & 4 deletions share/html/Admin/Lifecycles/Mappings.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,8 @@ <h6 class="text-center my-3"><&|/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'));
}
});
}
});
Expand Down
8 changes: 6 additions & 2 deletions share/html/Admin/Users/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
9 changes: 6 additions & 3 deletions share/html/Elements/AuthToken/Create
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
);
Expand Down

0 comments on commit d906a01

Please sign in to comment.