Fix navigation links in collection case details and enhance form handling for case detail updates
This commit is contained in:
@@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
{% if previous %}
|
{% if previous %}
|
||||||
<a href="{% url 'atlas:collection_case_questions' collection.id previous.id %}">Previous question</a>
|
<a href="{% url 'atlas:collection_case_details' collection.id previous.id %}">Previous question</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
Viewing question as part of collection: <a href="{% url 'atlas:collection_detail' collection.id %}">{{collection.name}}</a> [{{case_number|add:1}}/{{collection_length}}]
|
Viewing question as part of collection: <a href="{% url 'atlas:collection_detail' collection.id %}">{{collection.name}}</a> [{{case_number|add:1}}/{{collection_length}}]
|
||||||
{% if next %}
|
{% if next %}
|
||||||
<a href="{% url 'atlas:collection_case_questions' collection.id next.id %}">Next question</a>
|
<a href="{% url 'atlas:collection_case_details' collection.id next.id %}">Next question</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -44,14 +44,15 @@
|
|||||||
{{casedetail.case.title}}
|
{{casedetail.case.title}}
|
||||||
|
|
||||||
|
|
||||||
(<a href="{% url 'atlas:collection_case_displaysetup' casedetail.collection.pk casedetail.case.pk %}"><i class="bi bi-display" title="Setup default display"></i></a>)
|
(<a href="{% url 'atlas:collection_case_displaysetup' casedetail.collection.pk casedetail.case.pk %}"><i class="bi bi-display" title="Setup default display"></i></a>
|
||||||
(<a href="{% url 'atlas:collection_case_details' casedetail.collection.pk casedetail.case.pk %}"><i class="bi bi-info-square" title="Case details"></i></a>)
|
|
||||||
|
|
||||||
{% if casedetail.default_viewerstate %}
|
{% if casedetail.default_viewerstate %}
|
||||||
<i class="bi bi-check text-success" title="This case has a default viewerstate defined"></i>
|
<i class="bi bi-check text-success" title="This case has a default viewerstate defined"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(<a href="{% url 'atlas:collection_case_details' casedetail.collection.pk casedetail.case.pk %}"><i class="bi bi-info-square" title="Case details"></i></a>)
|
||||||
|
|
||||||
{% if collection.collection_type == "QUE" %}
|
{% if collection.collection_type == "QUE" %}
|
||||||
(<a href='{% url "atlas:collection_case_questions" casedetail.collection.pk casedetail.case.pk %}'>
|
(<a href='{% url "atlas:collection_case_questions" casedetail.collection.pk casedetail.case.pk %}'>
|
||||||
{% if casedetail.question_schema %}
|
{% if casedetail.question_schema %}
|
||||||
|
|||||||
@@ -2346,6 +2346,17 @@ def collection_case_details(request, exam_id, case_id):
|
|||||||
|
|
||||||
collection = case_detail.collection
|
collection = case_detail.collection
|
||||||
|
|
||||||
|
if request.method == "POST":
|
||||||
|
form = CaseDetailForm(request.POST, instance=case_detail)
|
||||||
|
if form.is_valid():
|
||||||
|
form.save()
|
||||||
|
if request.htmx:
|
||||||
|
return HttpResponse("Saved")
|
||||||
|
return redirect(request.path)
|
||||||
|
else:
|
||||||
|
if request.htmx:
|
||||||
|
return HttpResponse("Invalid form", status=400)
|
||||||
|
else:
|
||||||
form = CaseDetailForm(instance=case_detail)
|
form = CaseDetailForm(instance=case_detail)
|
||||||
|
|
||||||
case_number, case_count = collection.get_index_of_case(
|
case_number, case_count = collection.get_index_of_case(
|
||||||
|
|||||||
Reference in New Issue
Block a user