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 %} {% elif cid_user_exam.completed %} {% endif %} - +
{{answer_count}} out of {{exam_length}} questions answered. Unanswered questions are shown in red. Click any tile to jump to that question.
@@ -63,9 +63,9 @@ {% endfor %}
- Start time: {{cid_user_exam.start_time}}
- Last change time: {{cid_user_exam.end_time}}
- Completed: {{cid_user_exam.completed}} + Start time: {{cid_user_exam.start_time}}
+ Last change time: {{cid_user_exam.end_time}}
+ Completed: {{cid_user_exam.completed}}
{% if not cid_user_exam.completed %} @@ -97,69 +97,69 @@ {% endblock %} {% block css %} - + + @media (max-width: 575.98px) { + .physics-finish-list { + /* On very small screens allow slightly narrower tiles but still wrap */ + grid-template-columns: repeat(auto-fit, minmax(70px, 110px)); + } + .overview-question-btn { font-size: .95rem } + } + {% endblock %} diff --git a/physics/templates/physics/partials/exam_take_fragment.html b/physics/templates/physics/partials/exam_take_fragment.html index 08410727..f6ade5d7 100644 --- a/physics/templates/physics/partials/exam_take_fragment.html +++ b/physics/templates/physics/partials/exam_take_fragment.html @@ -86,6 +86,8 @@ try { var qnum = document.getElementById('question-number'); if (qnum) { qnum.textContent = '{{ pos|add:"1" }}'; } + // expose current question index for global listeners + window.currentQuestionPos = {{ pos }}; var qstem = document.getElementById('question-stem'); if (qstem) { qstem.innerHTML = '{{ question.stem|escapejs }}'; } } catch (err) {