Skip to content

Commit 969fa1d

Browse files
committed
tags on existing events display correctly in edit
1 parent 735ce02 commit 969fa1d

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

templates/events/form.html

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
{% endblock %}
88

99
{% block content %}
10+
11+
<script>
12+
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
13+
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
14+
</script>
15+
16+
<script type="module">
17+
import Tags from "{{ url_for('static', filename='js/tags.min.js') }}";
18+
Tags.init();
19+
</script>
20+
1021
<div class="container text-center my-4">
1122
<h1>{% if event %}Edit{% else %}Create{% endif %} Event</h1>
1223
</div>
@@ -191,9 +202,7 @@ <h1>{% if event %}Edit{% else %}Create{% endif %} Event</h1>
191202
<!-- tags from https://github.com/lekoala/bootstrap5-tags -->
192203
<div class="form-floating col-md-8 offset-md-2">
193204
<select class="form-select" id="tags" name="tags[]" multiple data-allow-new="true" data-allow-clear="true" data-separator=" |,| " >
194-
{% if not (event and event.tags) %}
195-
<option value="" disabled selected>Select tags</option>
196-
{% endif %}
205+
<option value="" disabled selected {% if not (event and event.tags) %}hidden{% endif %}>Select tags...</option>
197206
{% for tag in tags %}
198207
<option value="{{ tag }}" {% if event and (tag in event.tags | selectattr('name') | map(attribute='name') | list) %}selected="selected"{% endif %}>
199208
{{ tag }}
@@ -218,14 +227,4 @@ <h1>{% if event %}Edit{% else %}Create{% endif %} Event</h1>
218227
{% endfor %}
219228
</div>
220229

221-
<script>
222-
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
223-
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
224-
</script>
225-
226-
<script type="module">
227-
import Tags from "{{ url_for('static', filename='js/tags.min.js') }}";
228-
Tags.init();
229-
</script>
230-
231230
{% endblock %}

0 commit comments

Comments
 (0)