Skip to content
Snippets Groups Projects
Commit 134bf084 authored by Johannes Wolf's avatar Johannes Wolf
Browse files

correctly handle select2 in delegation modal

parent cd7acfef
No related branches found
No related tags found
No related merge requests found
......@@ -98,18 +98,21 @@
templateForm.insertAfter($('.select2form'));
// put this into a function for later re-use
applySelect2 = function(elem) {
applySelect2 = function(elem, parent = $(document.body)) {
elem.each(function() {
$(this).select2({
language: "{{ LANGUAGE_CODE }}",
placeholder: "{% trans 'Please select...' %}",
minimumResultsForSearch: 15,
minimumInputLength: $(this).children('option').length > 50 ? 3 : 0,
allowClear: this.multiple
allowClear: this.multiple,
dropdownParent: parent
});
});
};
applySelect2($('select').not('.form-template select').not('[disabled]').not('.no-select2'));
applySelect2($('select').not('.form-template select').not('[disabled]').not('.no-select2').not('#id_delegate_to'));
// handle delegation modal, which includes a dropdown select field
applySelect2($('select#id_delegate_to'), $('#delegateSelectionModal'));
// don't use the placeholder text on disabled select2 elements
applySelect2Disabled = function(elem) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment