Enhance candidate lists by adding badge containers for improved visual feedback on submission status.

This commit is contained in:
Ross
2026-01-05 11:52:58 +00:00
parent 378d784435
commit 459b7f9b93
3 changed files with 23 additions and 10 deletions
+21 -9
View File
@@ -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;
}
}
@@ -22,6 +22,7 @@
<div class="small text-muted mt-1 cid-notes" title="{{ cid.notes|escape }}" data-bs-toggle="tooltip" data-bs-placement="top">Notes: {{ cid.notes|truncatechars:120 }}</div>
{% endif %}
</div>
<div class="badge-container d-flex align-items-center ms-3"></div>
</div>
</li>
{% endfor %}
@@ -18,7 +18,7 @@
</div>
<div class="small">Email: {{ user.email }}</div>
</div>
<div class="small text-muted">&nbsp;</div>
<div class="badge-container d-flex align-items-center ms-3"></div>
</li>
{% endfor %}
</ul>