Refactor exam management: update exam edit form and add exam links partial
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
{% load static %}
|
||||
<div id="exam-list">
|
||||
<form hx-post="{% url 'anatomy:question_add_exam' question_id=question.pk %}" hx-target="#exam-list" hx-swap="innerHTML">
|
||||
<form id="exam-edit-form">
|
||||
{% csrf_token %}
|
||||
{{ form.media }}
|
||||
<div class="input-group mb-2">
|
||||
{{ form.exam }}
|
||||
<button class="btn btn-sm btn-primary" type="submit">Save</button>
|
||||
<button class="btn btn-sm btn-primary" type="button" hx-post="{% url 'anatomy:question_add_exam' question_id=question.pk %}" hx-include="#id_exam" hx-target="#exam-list" hx-swap="innerHTML">Save</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick="document.getElementById('exam-list').innerHTML='';">Close</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<div id="exam-links" class="small" hx-swap-oob="outerHTML">
|
||||
{% if question.exams.all %}
|
||||
{% for exam in question.exams.all %}
|
||||
<a href="{% url 'anatomy:exam_overview' pk=exam.pk %}" class="me-2">{{ exam }}</a>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
No exams
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -156,13 +156,7 @@
|
||||
|
||||
<div class="mt-3">
|
||||
<h6>Exams</h6>
|
||||
<div class="small">
|
||||
{% for exam in question.exams.all %}
|
||||
<a href="{% url 'anatomy:exam_overview' pk=exam.pk %}" class="me-2">{{ exam }}</a>
|
||||
{% empty %}
|
||||
No exams
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% include 'anatomy/partials/exam_links.html' %}
|
||||
{% if can_edit %}
|
||||
<div class="mt-2"><button class="btn btn-sm btn-outline-secondary" hx-get="{% url 'anatomy:question_add_exam' question_id=question.pk %}" hx-target="#exam-list" hx-swap="innerHTML">Edit exam(s)</button>
|
||||
<span id="exam-list"></span>
|
||||
|
||||
Reference in New Issue
Block a user