Modify some select2 box

This commit is contained in:
cuom1999 2024-02-05 15:15:32 -06:00
parent 847e8b6660
commit 695fa85b19
13 changed files with 50 additions and 31 deletions

View file

@ -90,7 +90,15 @@
.css({'visibility': 'visible'});
$('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'})
.css({'visibility': 'visible'});
$('#search-author').select2({multiple: 1, placeholder: '{{ _('Authors') }}...'})
$('#search-author').select2({
multiple: 1,
placeholder: '{{ _('Authors') }}...',
ajax: {
url: '{{ url('problem_authors_select2_ajax') }}',
delay: 250,
cache: true,
}
})
.css({'visibility': 'visible'});
// This is incredibly nasty to do but it's needed because otherwise the select2 steals the focus

View file

@ -49,9 +49,9 @@
<div class="filter-form-group">
<label class="bold-text margin-label" for="type"><i class="non-italics">{{ _('Author') }}</i></label>
<select id="search-author" name="authors" multiple>
{% for author in all_authors %}
<option value="{{ author.id }}"{% if author.id in author_query %} selected{% endif %}>
{{ author.user__username }}
{% for author in author_query %}
<option value="{{ author.id }}" selected>
{{ author.username }}
</option>
{% endfor %}
</select>