Big entry qr beside the ring as an admin option (corner again once a question is up); admin lists questions newest first, open vote on top

This commit is contained in:
2026-11-17 14:12:26 +01:00
parent 70d09b1008
commit d761d8b510
7 changed files with 31 additions and 5 deletions
+5 -2
View File
@@ -78,6 +78,8 @@ function renderSettings(p) {
if (active !== $("#s-max")) $("#s-max").value = p.max_voters ?? "";
if (active !== $("#s-vote-scans")) $("#s-vote-scans").value = String(p.vote_scans);
if (active !== $("#s-code-style")) $("#s-code-style").value = p.code_style;
if (active !== $("#s-entry-big")) $("#s-entry-big").value = p.entry_big ? "1" : "0";
$("#s-entry-big").disabled = p.code_style !== "ring";
$("#s-code").checked = p.require_code;
$("#access-row").hidden = !p.require_code && !state.codes.access.total;
const sum = (c, none) => (c.total ? `${c.used} utilisé${c.used > 1 ? "s" : ""} sur ${c.total}` : none);
@@ -92,8 +94,8 @@ function renderQuestions() {
box.append(h("p", { class: "empty" }, "Aucune question pour l'instant."));
return;
}
const order = { open: 0, draft: 1, closed: 2 };
const qs = [...state.questions].sort((a, b) => order[a.state] - order[b.state] || a.id - b.id);
// the open vote first, then newest first: a question just created or just closed stays at the top
const qs = [...state.questions].sort((a, b) => (b.state === "open") - (a.state === "open") || b.id - a.id);
for (const q of qs) box.append(questionCard(q));
}
@@ -207,6 +209,7 @@ const SETTINGS = {
"#s-code": (el) => ({ require_code: el.checked }),
"#s-vote-scans": (el) => ({ vote_scans: +el.value }),
"#s-code-style": (el) => ({ code_style: el.value }),
"#s-entry-big": (el) => ({ entry_big: el.value === "1" }),
};
for (const [sel, build] of Object.entries(SETTINGS)) {
$(sel).addEventListener("change", async (e) => {
+4
View File
@@ -49,6 +49,10 @@ function layout() {
const entryOn = !!(ring && st.enrollment_open && entry);
reveal($("#entry"), entryOn);
document.body.classList.toggle("has-entry", entryOn);
// big entry qr next to the ring (start of a meeting), back to the corner once a question is up
const big = entryOn && st.entry_big && !focus;
document.body.classList.toggle("entry-big", big);
$("#entry-hint").textContent = big ? "Scannez ici, puis visez le cercle" : "Pas encore sur la page ?";
$(".qr-wrap").classList.toggle("ring", ring);
}