Skip to content

Commit 1b87121

Browse files
committed
Remove fallback as Select2 is already globally included
1 parent 8c84654 commit 1b87121

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

cmd/admin/templates/table.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,12 +411,15 @@ <h4 class="modal-title">Tag nodes</h4>
411411
$(this).find('#carve').focus();
412412
});
413413

414-
// Select2 initialization
415-
var tagsSelect = $('#modal_tags').select2({
416-
theme: "classic"
417-
});
418-
tagsSelect.on("select2:select", function(e){
419-
$('#add_tags').append(new Option(e.params.data.text, e.params.data.text));
414+
// Deferred Select2 initialization
415+
var _tagsSelectReady = false;
416+
$('#tagModal').one('shown.bs.modal', function(){
417+
if(_tagsSelectReady) return;
418+
var tagsSelect = $('#modal_tags').select2({ theme: 'classic' });
419+
tagsSelect.on('select2:select', function(e){
420+
$('#add_tags').append(new Option(e.params.data.text, e.params.data.text));
421+
});
422+
_tagsSelectReady = true;
420423
});
421424
});
422425
</script>

0 commit comments

Comments
 (0)