+ {% if error %}
+
{{ error }}
+ {% endif %}
{{case.title}}
diff --git a/atlas/templates/atlas/partials/_viewing_case_as_part_of_collection.html b/atlas/templates/atlas/partials/_viewing_case_as_part_of_collection.html
new file mode 100644
index 00000000..eaecffc7
--- /dev/null
+++ b/atlas/templates/atlas/partials/_viewing_case_as_part_of_collection.html
@@ -0,0 +1,24 @@
+
+
+
+
+
Viewing as part of a collection
+
+
+
+ {% if next %}
+
Next →
+ {% endif %}
+
+
+
+ {% include "atlas/collection_detail.html#casedetails-management-links" %}
+
+
\ No newline at end of file
diff --git a/atlas/templates/atlas/partials/case_list_item.html b/atlas/templates/atlas/partials/case_list_item.html
index d75b1aae..98ef38a6 100644
--- a/atlas/templates/atlas/partials/case_list_item.html
+++ b/atlas/templates/atlas/partials/case_list_item.html
@@ -14,7 +14,7 @@
{% if casedetail.case.series.count == 0 %}
- No series attached
+ This case has no series / stacks attached
{% else %}
{{ casedetail.case.series.count }} series
{% endif %}
diff --git a/atlas/templates/atlas/question_link_header.html b/atlas/templates/atlas/question_link_header.html
index 246b44c3..38601583 100644
--- a/atlas/templates/atlas/question_link_header.html
+++ b/atlas/templates/atlas/question_link_header.html
@@ -18,22 +18,8 @@
- {% if collection %}
-
-
Collection
-
- {% include "atlas/collection_detail.html#casedetails-management-links" %}
-
-
- {% if previous %}
-
Previous
- {% endif %}
- Viewing question as part of a collection:
{{ collection.name }}
- [{{ case_number|add:1 }} / {{ collection_length }}]
- {% if next %}
-
Next
- {% endif %}
-
-
- {% endif %}
+
+ {% if collection %}
+ {% include 'atlas/partials/_viewing_case_as_part_of_collection.html' with nav_link_view="atlas:collection_case_view" %}
+ {% endif %}
\ No newline at end of file
diff --git a/atlas/views.py b/atlas/views.py
index 776da8a3..91cf4961 100755
--- a/atlas/views.py
+++ b/atlas/views.py
@@ -2763,6 +2763,7 @@ def collection_case_priors(request, exam_id, case_id):
if request.htmx:
# Ensure we can render the updated single-card partial and return it so HTMX
# can swap the card on the client side.
+
if "remove" in request.POST:
prior_pk = request.POST["remove"]
try:
@@ -2792,10 +2793,27 @@ def collection_case_priors(request, exam_id, case_id):
return HttpResponse(html)
elif "prior_case_id" in request.POST:
if not request.POST.get("relation"):
- return HttpResponse(
- "You need to enter text to describe the relationship between the cases",
- status=400,
+ # Return the card partial with an inline error so HTMX will replace
+ # the card and display the validation message rather than navigating
+ # to a new page or showing a plain text response.
+ prior_case = Case.objects.get(pk=request.POST.get("prior_case_id"))
+ added = False
+ relation = request.POST.get("relation", "")
+ visibility = request.POST.get("prior_visibility", "AL")
+ html = render_to_string(
+ "atlas/partials/_prior_card.html",
+ {
+ "case": prior_case,
+ "added": added,
+ "relation": relation,
+ "visibility": visibility,
+ "case_detail": case_detail,
+ "collection": collection,
+ "error": "You need to enter text to describe the relationship between the cases",
+ },
+ request=request,
)
+ return HttpResponse(html)
prior_case = Case.objects.get(pk=request.POST["prior_case_id"])
p, created = CasePrior.objects.get_or_create(
case_detail=case_detail, prior_case=prior_case
@@ -3576,8 +3594,8 @@ def collection_case_view(request, pk, case_number):
series_list = case.series.all().prefetch_related("images", "examination", "plane")
- previous = case_number > 0
- next = case_number < (case_count - 1)
+ previous = collection.get_previous_case(casedetail.case)
+ next = collection.get_next_case(casedetail.case)
return render(
request,