diff --git a/generic/templates/generic/examcollection_detail.html b/generic/templates/generic/examcollection_detail.html
index aa2f5aac..0881019b 100755
--- a/generic/templates/generic/examcollection_detail.html
+++ b/generic/templates/generic/examcollection_detail.html
@@ -32,7 +32,10 @@
-
Loading anatomy exams…
+
+
Loading anatomy exams…
+
+
@@ -48,7 +51,10 @@
-
Loading longs exams…
+
+
Loading longs exams…
+
+
@@ -64,7 +70,10 @@
-
Loading rapids exams…
+
+
Loading rapids exams…
+
+
@@ -80,7 +89,10 @@
-
Loading shorts exams…
+
+
Loading shorts exams…
+
+
@@ -93,7 +105,10 @@
View exam list
-
Loading physics exams…
+
+
Loading physics exams…
+
+
{% endif %}
@@ -105,7 +120,10 @@
View exam list
-
Loading SBAs exams…
+
+
Loading SBAs exams…
+
+
{% endif %}
diff --git a/generic/templates/generic/partials/exams/exam_status.html b/generic/templates/generic/partials/exams/exam_status.html
index 38657b81..5cbcc355 100644
--- a/generic/templates/generic/partials/exams/exam_status.html
+++ b/generic/templates/generic/partials/exams/exam_status.html
@@ -2,11 +2,11 @@
{% partialdef publish-results %}
-
Publish results
+
Results
{% if exam.publish_results %}
+
{% else %}
+
{% endif %}
@@ -33,11 +35,11 @@
{% partialdef exam-active %}
-
Exam active
+
Exam status:
{% if exam.active %}
+
{% else %}
+
{% endif %}
-{% endpartialdef exam-active %}
\ No newline at end of file
+{% endpartialdef exam-active %}
+
+{% partialdef exam-archived %}
+
+
+ {% if exam.archive %}
+
+
+ {% else %}
+
+
+ {% endif %}
+
+
+{% endpartialdef %}
\ No newline at end of file
diff --git a/generic/views.py b/generic/views.py
index 7b9d913a..612f3a5e 100644
--- a/generic/views.py
+++ b/generic/views.py
@@ -1112,9 +1112,25 @@ class ExamViews(View, LoginRequiredMixin):
exam = get_object_or_404(self.Exam, pk=pk)
- exam.archive = True if request.POST.get("archive") == "true" else False
- print(f"{exam.archive=}")
+ # Support both legacy JSON POSTs and HTMX button toggles.
+ # If this is an HTMX request, toggle the archive flag and
+ # return the `exam-archived` partial for in-place replacement.
+ is_htmx = request.headers.get("HX-Request") == "true"
+ if is_htmx:
+ exam.archive = not exam.archive
+ else:
+ # Legacy POST expects 'archive' == 'true'
+ exam.archive = True if request.POST.get("archive") == "true" else False
+
exam.save()
+
+ if is_htmx:
+ return render(
+ request,
+ "generic/partials/exams/exam_status.html#exam-archived",
+ {"exam": exam, "collection": exam},
+ )
+
data = {
"status": "success",
"archive": exam.archive,
diff --git a/templates/exam_list.html b/templates/exam_list.html
index 5721c07a..d0c96b51 100644
--- a/templates/exam_list.html
+++ b/templates/exam_list.html
@@ -33,17 +33,20 @@
{% else %}
{{ exam.valid_user_users.count }}
{% endif %}
- ]
+ ]
Scores
-
-
-
-
+
+ {% include "generic/partials/exams/exam_status.html#exam-active" %}
+
+
+ {% include "generic/partials/exams/exam_status.html#publish-results" %}
+
-
-
+
+ {% include "generic/partials/exams/exam_status.html#exam-archived" %}
+
{% endfor %}
@@ -70,6 +73,11 @@
-webkit-user-select: none;
-moz-user-select: none;
text-align: center;
+ padding: 0.15rem 0.45rem;
+ font-size: 0.85rem;
+ line-height: 1;
+ vertical-align: middle;
+ min-width: 3.4rem;
}
.archived-icon {
@@ -82,23 +90,26 @@
opacity: 100%;
}
- .exam-active-switch:checked + .active-icon {
- border: 1px solid green;
- color: green;
- opacity: 100%;
- display: inline-block;
+ /* Styling for active/published/archive buttons to match previous compact look */
+ .active-icon.btn-success, .active-icon.btn-primary {
+ border: 1px solid #198754;
+ color: #198754;
+ opacity: 1;
+ background: transparent;
}
- .exam-publish-results-switch:checked + .published-icon {
+ .published-icon.btn-success {
border: 1px solid purple;
color: purple;
- opacity: 100%;
- display: inline-block;
+ opacity: 1;
+ background: transparent;
}
- .exam-archived-switch:checked + .archived-icon {
+ .archived-icon.btn-warning {
color: darkblue;
- opacity: 100%;
+ opacity: 1;
+ background: transparent;
+ border: 1px solid #ffc107;
}
.exam-publish-results-switch, .exam-active-switch, .exam-archived-switch {
diff --git a/templates/exam_overview_js.html b/templates/exam_overview_js.html
index 0915f7a2..60cd06fa 100644
--- a/templates/exam_overview_js.html
+++ b/templates/exam_overview_js.html
@@ -1,104 +1,38 @@