Refactor exam status components to use consistent class names and improve HX target selectors for better maintainability
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{% load partials %}
|
||||
|
||||
{% partialdef publish-results %}
|
||||
<div id="publish-results-status" class="d-flex align-items-center gap-2">
|
||||
<div class="exam-status-container d-flex align-items-center gap-2">
|
||||
<div class="me-2 small text-muted">Results</div>
|
||||
<div>
|
||||
{% if exam.publish_results %}
|
||||
@@ -9,7 +9,7 @@
|
||||
class="btn btn-sm btn-success published-icon"
|
||||
hx-post="{% url exam.get_app_name|add:':exam_toggle_results_published' exam.pk %}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#publish-results-status"
|
||||
hx-target="closest .exam-status-container"
|
||||
title="Click to unpublish results"
|
||||
aria-label="Unpublish results"
|
||||
hx-disabled-elt="this"
|
||||
@@ -21,7 +21,7 @@
|
||||
class="btn btn-sm btn-secondary published-icon"
|
||||
hx-post="{% url exam.get_app_name|add:':exam_toggle_results_published' exam.pk %}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#publish-results-status"
|
||||
hx-target="closest .exam-status-container"
|
||||
title="Click to publish results"
|
||||
aria-label="Publish results"
|
||||
hx-disabled-elt="this"
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
|
||||
{% partialdef exam-active %}
|
||||
<div id="exam-active-status" class="d-flex align-items-center gap-2">
|
||||
<div class="exam-status-container d-flex align-items-center gap-2">
|
||||
<div class="me-2 small text-muted">Exam status:</div>
|
||||
<div>
|
||||
{% if exam.active %}
|
||||
@@ -42,7 +42,7 @@
|
||||
class="btn btn-sm btn-success active-icon"
|
||||
hx-post="{% url exam.get_app_name|add:':exam_toggle_active' exam.pk %}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#exam-active-status"
|
||||
hx-target="closest .exam-status-container"
|
||||
title="Click to deactivate this exam"
|
||||
aria-label="Deactivate exam"
|
||||
hx-disabled-elt="this"
|
||||
@@ -53,7 +53,7 @@
|
||||
class="btn btn-sm btn-secondary active-icon"
|
||||
hx-post="{% url exam.get_app_name|add:':exam_toggle_active' exam.pk %}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#exam-active-status"
|
||||
hx-target="closest .exam-status-container"
|
||||
title="Click to activate this exam"
|
||||
aria-label="Activate exam"
|
||||
hx-disabled-elt="this"
|
||||
@@ -65,14 +65,14 @@
|
||||
{% endpartialdef exam-active %}
|
||||
|
||||
{% partialdef exam-archived %}
|
||||
<div id="exam-archived-status" class="d-flex align-items-center gap-2">
|
||||
<div class="exam-status-container d-flex align-items-center gap-2">
|
||||
<div>
|
||||
{% if exam.archive %}
|
||||
<button
|
||||
class="btn btn-sm btn-warning archived-icon"
|
||||
hx-post="{% url exam.get_app_name|add:':exam_toggle_archived' exam.pk %}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#exam-archived-status"
|
||||
hx-target="closest .exam-status-container"
|
||||
title="Click to unarchive this exam"
|
||||
aria-label="Unarchive exam"
|
||||
><i class="bi bi-archive"></i></button>
|
||||
@@ -82,7 +82,7 @@
|
||||
class="btn btn-sm btn-secondary archived-icon"
|
||||
hx-post="{% url exam.get_app_name|add:':exam_toggle_archived' exam.pk %}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#exam-archived-status"
|
||||
hx-target="closest .exam-status-container"
|
||||
title="Click to archive this exam"
|
||||
aria-label="Archive exam"
|
||||
><i class="bi bi-archive"></i></button>
|
||||
|
||||
Reference in New Issue
Block a user