diff --git a/physics/templates/physics/exam_take.html b/physics/templates/physics/exam_take.html index b8e74a83..83d820fe 100755 --- a/physics/templates/physics/exam_take.html +++ b/physics/templates/physics/exam_take.html @@ -204,26 +204,26 @@ .physics-answer-list li { padding: 0.6rem; } } /* Question menu item states (small pill buttons) */ - button.question-menu-item { - color: var(--text); - border: 1px solid var(--card-border); - background: var(--card-bg); - padding: 0.25rem 0.5rem; - border-radius: 0.35rem; - display: inline-flex; - align-items: center; - gap: 0.4rem; - } - button.question-menu-item.answered { - border-color: var(--success) !important; /* answered -> success border */ - } + button.question-menu-item { + color: var(--text); + border: 1px solid var(--card-border); + background: var(--card-bg); + padding: 0.25rem 0.5rem; + border-radius: 0.35rem; + display: inline-flex; + align-items: center; + gap: 0.4rem; + } + button.question-menu-item.answered { + border-color: var(--success) !important; /* answered -> success border */ + } /* flagged items show an icon only; no border change here */ - button.question-menu-item .question-flag { - margin-left: 0.25rem; - font-size: 0.85em; - color: #ffc107; - line-height: 1; - } + button.question-menu-item .question-flag { + margin-left: 0.25rem; + font-size: 0.85em; + color: #ffc107; + line-height: 1; + } {% endblock %} @@ -298,6 +298,16 @@ requestAnimationFrame(function(){ el.style.opacity = '1'; }); // hide after 1.6s setTimeout(function(){ el.style.opacity = '0'; }, 1600); + // Update the question list state locally so the menu reflects answered questions + try { + var pos = (typeof window.currentQuestionPos === 'number') ? window.currentQuestionPos : (document.getElementById('question-number') ? parseInt(document.getElementById('question-number').textContent, 10) - 1 : NaN); + if (!isNaN(pos)) { + window.examQuestionAnswered = window.examQuestionAnswered || new Array({{ exam_length }}).fill(false); + window.examQuestionAnswered[pos] = true; + var btn = document.querySelector('#menu-list [data-qn="' + pos + '"]'); + if (btn) btn.classList.add('answered'); + } + } catch (e) { console && console.error && console.error(e); } } catch (e) { console && console.error && console.error(e); } }); diff --git a/physics/templates/physics/exam_take_overview.html b/physics/templates/physics/exam_take_overview.html index 3ff7987d..93f98170 100644 --- a/physics/templates/physics/exam_take_overview.html +++ b/physics/templates/physics/exam_take_overview.html @@ -2,11 +2,11 @@ {% block content %} - {% if not cid %} - User: {{request.user}} - {% else %} - CID: {{cid}} - {% endif %} + {% if not cid %} + User: {{request.user}} + {% else %} + CID: {{cid}} + {% endif %} {% include "exam_clock.html" %} @@ -14,7 +14,7 @@ {% if exam.publish_results %}