diff --git a/anatomy/static/css/anatomy.css b/anatomy/static/css/anatomy.css index 076a485f..30ef8fc0 100644 --- a/anatomy/static/css/anatomy.css +++ b/anatomy/static/css/anatomy.css @@ -650,5 +650,12 @@ input { .sba-answer-list { list-style-type: lower-alpha; - display: flex; +} + +#menu-list button { + padding-left: 2px; + padding-right: 2px; + padding-top: 0px; + padding-bottom: 0px; + margin: 1px; } \ No newline at end of file diff --git a/sbas/templates/sbas/exam_take.html b/sbas/templates/sbas/exam_take.html index 8e582437..61531567 100755 --- a/sbas/templates/sbas/exam_take.html +++ b/sbas/templates/sbas/exam_take.html @@ -5,7 +5,9 @@ CID: {{cid}}

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

-

{{question.stem|safe}}

+
+

{{question.stem|safe}}

+
+ +
+ +
{% csrf_token %} +
+ {{form}} +
+ + {% if previous > -1 %} + + {% endif %} + {% if next %} + + {% else %} + + {% endif %} +
+ + +
+
+ +

Questions

- -
- -
{% csrf_token %} -
-{{form}} -
- -{% if previous > -1 %} - -{% endif %} -{% if next %} - -{% else %} - -{% endif %} -
- -
-
- {% endblock %} {% block js %} @@ -52,19 +56,32 @@ CID: {{cid}} }) }) + /* beautify ignore:start */ {% if saved_answer %} - $("ul.sba-answer-list li[data-ans='{{saved_answer}}']").addClass("selected"); - {% endif %} + $("ul.sba-answer-list li[data-ans='{{saved_answer}}']").addClass("selected"); {% endif %} + + for (let i = 0; i < {{ exam_length }}; i++) { + $("#menu-list").append($( + ``)); - for (let i = 1; i < {{exam_length}} + 1; i++) { - $("#menu-list").append($(`
${i}
`)); } + /* beautify ignore:end */ + $("button.question-menu-item").on("click", (e) => { + console.log(e.currentTarget.dataset.qn); + document.getElementById("goto-button").value = e.currentTarget.dataset.qn; + $("#goto-button").click(); + }); }) {% endblock %} {% block css %} {% endblock %} \ No newline at end of file diff --git a/sbas/views.py b/sbas/views.py index d9f8dbd6..45f7e216 100644 --- a/sbas/views.py +++ b/sbas/views.py @@ -307,6 +307,8 @@ def exam_take(request, pk, sk, cid): return redirect("sbas:exam_take", pk=pk, sk=pos - 1, cid=cid) elif "finish" in request.POST: return redirect("sbas:exam_finish", pk=pk, cid=cid) + elif "goto" in request.POST: + return redirect("sbas:exam_take", pk=pk, sk=int(request.POST.get("goto")), cid=cid) else: form = CidUserAnswerForm(instance=answer) diff --git a/static/css/anatomy.css b/static/css/anatomy.css index 076a485f..30ef8fc0 100644 --- a/static/css/anatomy.css +++ b/static/css/anatomy.css @@ -650,5 +650,12 @@ input { .sba-answer-list { list-style-type: lower-alpha; - display: flex; +} + +#menu-list button { + padding-left: 2px; + padding-right: 2px; + padding-top: 0px; + padding-bottom: 0px; + margin: 1px; } \ No newline at end of file