Add HTMX support for exam selection and update related templates and views

This commit is contained in:
Ross
2025-10-20 21:12:42 +01:00
parent d342e7e047
commit 66711f5c15
7 changed files with 103 additions and 25 deletions
@@ -1,6 +1,6 @@
<div class="card">
<div class="card-body">
<form hx-post="{% url 'generic:generic_exam_json_edit' %}" hx-target="#action-result" hx-swap="innerHTML">
<form hx-post="{% url 'generic:generic_exam_htmx' %}" hx-target="#action-result" hx-swap="innerHTML">
<input type="hidden" name="type" value="{{ type }}" />
<div class="mb-2">
<label for="id_exam_id">Choose exam</label>
@@ -0,0 +1,10 @@
<div class="alert alert-success alert-sm" role="alert">
{% if added %}
Added {{ added }} question{{ added|pluralize }} to "{{ exam.name }}".
{% else %}
No new questions were added to "{{ exam.name }}".
{% endif %}
<div class="mt-2">
<button class="btn btn-sm btn-secondary" type="button" onclick="document.querySelector('#action-result').innerHTML='';">Close</button>
</div>
</div>
+1 -1
View File
@@ -21,7 +21,7 @@
</div>
<div class="btn-group" role="group">
<button id="button-select-add-exam" class="btn btn-outline-primary btn-sm"
hx-get="{% url 'generic:generic_exam_json_edit' %}?type={{ app_name }}"
hx-get="{% url 'generic:generic_exam_htmx' %}?type={{ app_name }}"
hx-target="#action-result"
hx-swap="innerHTML">Add to exam</button>
</div>