From 459b7f9b939b78c6612f5460c7d08931417f89f8 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 5 Jan 2026 11:52:58 +0000 Subject: [PATCH] Enhance candidate lists by adding badge containers for improved visual feedback on submission status. --- generic/templates/generic/exam_cids.html | 30 +++++++++++++------ .../generic/partials/exam_cids_cid_list.html | 1 + .../generic/partials/exam_cids_user_list.html | 2 +- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/generic/templates/generic/exam_cids.html b/generic/templates/generic/exam_cids.html index bf48ce6a..7d185bef 100644 --- a/generic/templates/generic/exam_cids.html +++ b/generic/templates/generic/exam_cids.html @@ -175,13 +175,15 @@ }); // Helper to ensure a single badge exists inside an li and update its tooltip - function ensureSubmittedBadge(li, title){ - let b = li.querySelector('.submitted-badge'); + function ensureBadge(li, selector, className, text, title){ + // Prefer the explicit badge container if present + const container = li.querySelector('.badge-container') || li; + let b = container.querySelector(selector); if(!b){ b = document.createElement('span'); - b.className = 'submitted-badge badge bg-success ms-2'; - b.textContent = 'Submitted'; - li.appendChild(b); + b.className = className; + b.textContent = text; + container.appendChild(b); } if(title){ b.setAttribute('title', title); @@ -198,8 +200,14 @@ const text = (link && link.textContent) ? link.textContent.trim() : (li.textContent||'').trim(); if(submittedCids.has(text)){ const info = submittedCids.get(text) || {first:'', last:''}; - const title = (info.first || info.last) ? `Submitted\nFirst: ${info.first}\nLast: ${info.last}` : ''; - ensureSubmittedBadge(li, title); + // add Started badge if start time exists + if(info.first){ + const t = `Started\nFirst: ${info.first}`; + ensureBadge(li, '.started-badge', 'started-badge badge bg-info ms-2', 'Started', t); + } + // add Submitted badge if end time exists (or always keep submitted) + const title = (info.first || info.last) ? `Submitted\nFirst: ${info.first}\nLast: ${info.last}` : 'Submitted'; + ensureBadge(li, '.submitted-badge', 'submitted-badge badge bg-success ms-2', 'Submitted', title); } }catch(e){ console.error('highlightSubmitted CID item error', e); } }); @@ -213,8 +221,12 @@ for(const user of submittedUsers.keys()){ if(txt.indexOf(user) !== -1){ const info = submittedUsers.get(user) || {first:'', last:''}; - const title = (info.first || info.last) ? `Submitted\nFirst: ${info.first}\nLast: ${info.last}` : ''; - ensureSubmittedBadge(li, title); + if(info.first){ + const t = `Started\nFirst: ${info.first}`; + ensureBadge(li, '.started-badge', 'started-badge badge bg-info ms-2', 'Started', t); + } + const title = (info.first || info.last) ? `Submitted\nFirst: ${info.first}\nLast: ${info.last}` : 'Submitted'; + ensureBadge(li, '.submitted-badge', 'submitted-badge badge bg-success ms-2', 'Submitted', title); break; } } diff --git a/generic/templates/generic/partials/exam_cids_cid_list.html b/generic/templates/generic/partials/exam_cids_cid_list.html index 0e23d7c4..d5940ace 100644 --- a/generic/templates/generic/partials/exam_cids_cid_list.html +++ b/generic/templates/generic/partials/exam_cids_cid_list.html @@ -22,6 +22,7 @@
Notes: {{ cid.notes|truncatechars:120 }}
{% endif %} +
{% endfor %} diff --git a/generic/templates/generic/partials/exam_cids_user_list.html b/generic/templates/generic/partials/exam_cids_user_list.html index c754a397..590d89ce 100644 --- a/generic/templates/generic/partials/exam_cids_user_list.html +++ b/generic/templates/generic/partials/exam_cids_user_list.html @@ -18,7 +18,7 @@
Email: {{ user.email }}
-
 
+
{% endfor %}