Enhance exam status management with HTMX loading indicators and streamline AJAX handling by removing legacy jQuery code

This commit is contained in:
Ross
2025-12-29 12:44:42 +00:00
parent 4ecc32f837
commit 94fbd38634
5 changed files with 140 additions and 129 deletions
+28 -17
View File
@@ -33,17 +33,20 @@
{% else %}
{{ exam.valid_user_users.count }}
{% endif %}
]</span>
]</span>
</span>
</span>
<a href="{% url app_name|add:':exam_scores_all' pk=exam.pk %}" class="flex-col-half">Scores</a>
<input type="checkbox" id="active-{{exam.pk}}" class="exam-active-switch" data-posturl="{% url app_name|add:':exam_toggle_active' pk=exam.pk %}" {% if exam.active %}checked{% endif %}>
<label for="active-{{exam.pk}}" class="flex-col icon-container active-icon" title="Click to toggle active state">Exam Active</label>
<input type="checkbox" id="published-{{exam.pk}}" class="exam-publish-results-switch" data-posturl="{% url app_name|add:':exam_toggle_results_published' pk=exam.pk %}" {% if exam.publish_results %}checked{% endif %}>
<label for="published-{{exam.pk}}" class="flex-col icon-container published-icon" title="Click to toggle published state">Results Published</label>
<span class="flex-col">
{% include "generic/partials/exams/exam_status.html#exam-active" %}
</span>
<span class="flex-col">
{% include "generic/partials/exams/exam_status.html#publish-results" %}
</span>
<a href="{% url app_name|add:':exam_update' pk=exam.pk %}" class="flex-shrink exam-list-edit-button"><i class="bi bi-pencil-square"></i></a>
<input type="checkbox" id="archived-{{exam.pk}}" class="exam-archived-switch" data-posturl="{% url app_name|add:':exam_toggle_archived' pk=exam.pk %}" {% if exam.archive %}checked{% endif %}>
<label for="archived-{{exam.pk}}" class="flex-shrink icon-archive archived-icon" title="Click to toggle archived state"><i class="bi bi-archive"></i></label>
<span class="flex-shrink">
{% include "generic/partials/exams/exam_status.html#exam-archived" %}
</span>
</li>
{% endfor %}
</ul>
@@ -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 {