25 lines
895 B
HTML
25 lines
895 B
HTML
<!-- File: plugins/utility/templates/search/_form_scripts.html -->
|
|
{# Optional: include this partial if you use Select2 for tags autocomplete #}
|
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0/dist/css/select2.min.css" rel="stylesheet"/>
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0/dist/js/select2.min.js"></script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('select[name="tags"]').select2({
|
|
placeholder: 'Select tags',
|
|
ajax: {
|
|
url: '{{ url_for("search.search_tags") }}',
|
|
dataType: 'json',
|
|
delay: 250,
|
|
data: params => ({ term: params.term }),
|
|
processResults: data => ({
|
|
results: data.map(name => ({ id: name, text: name }))
|
|
}),
|
|
cache: true
|
|
},
|
|
minimumInputLength: 1,
|
|
allowClear: true
|
|
});
|
|
});
|
|
</script>
|