From b13261c302b668efe336d0379b0f102f4522dae8 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 6 Jul 2026 11:34:58 +0100 Subject: [PATCH] feat: implement HTMX support for exam question navigation and flagging functionality --- sbas/templates/sbas/exam_take.html | 252 +++++++++++------- .../sbas/partials/exam_flag_button.html | 17 ++ .../sbas/partials/exam_take_fragment.html | 146 ++++++++++ sbas/tests/test_sbas_exams.py | 47 +++- sbas/urls.py | 21 ++ sbas/views.py | 186 ++++++++++++- todo | 2 +- 7 files changed, 564 insertions(+), 107 deletions(-) create mode 100644 sbas/templates/sbas/partials/exam_flag_button.html create mode 100644 sbas/templates/sbas/partials/exam_take_fragment.html diff --git a/sbas/templates/sbas/exam_take.html b/sbas/templates/sbas/exam_take.html index 9b86231f..b964702a 100755 --- a/sbas/templates/sbas/exam_take.html +++ b/sbas/templates/sbas/exam_take.html @@ -1,9 +1,9 @@ {% extends 'base.html' %} {% block content %} -
-
- +
+
+ {% if request.user.is_authenticated %} User: {{ request.user }} @@ -12,101 +12,92 @@ {% endif %}

{{ exam }}: Question [{{ pos|add:1 }}/{{ exam_length }}]

- -
- {% include "exam_clock.html" %} -
-
- {% if exam.publish_results %} - - {% elif cid_user_exam.completed %} - - {% endif %} - -
- {# Layout change: make both columns full-width so the right panel is not a sidebar #} -
-
-
-
{{ question.stem|safe }}
- -
    -
  • {{ question.a_answer|safe }}
  • -
  • {{ question.b_answer|safe }}
  • -
  • {{ question.c_answer|safe }}
  • -
  • {{ question.d_answer|safe }}
  • -
  • {{ question.e_answer|safe }}
  • -
- -
{% csrf_token %} -
{{ form }}
- -
-
- {% if previous > -1 %} - - {% endif %} - - {% if next %} - - {% else %} - {% if not exam.publish_results %} - - {% endif %} - {% endif %} -
- -
- {% if exam.publish_results and question.feedback %} -
-
Feedback
-
{{ question.feedback|safe }}
-
- {% endif %} - - -
-
-
-
+
+ {% include "exam_clock.html" %}
-
- {% include "sbas/exam_take_help.html" %} + {% if exam.publish_results %} + + {% elif cid_user_exam.completed %} + + {% endif %} -
-
-
Questions
-

Tap a number to jump to that question.

+
+ {# Layout change: make both columns full-width so the right panel is not a sidebar #} +
+
+
+
+

+
+ +
+ +
+
+
+
+ +
+ {% include "sbas/exam_take_help.html" %} + +
+
+
Questions
+

Tap a number to jump to that question.

-
- -
+
+ +
-
+
- -
{% endblock %} {% block js %} + {% endblock %} {% block css %}