From e1f837d4aef61846c617b61f00d69355170766e9 Mon Sep 17 00:00:00 2001 From: Sandy Currier Date: Mon, 4 Mar 2024 15:31:05 -0500 Subject: [PATCH] the checkout page has a heartbeat; UI not done yet --- voting.html | 89 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 72 insertions(+), 17 deletions(-) diff --git a/voting.html b/voting.html index 00cf9dd..e116de9 100644 --- a/voting.html +++ b/voting.html @@ -131,12 +131,12 @@ // Note - the last progress bar section wants to the same class // as the other so not to have any borders newBarElement.setAttribute("class", "yrhSection"); - newBarElement.setAttribute("id", "progBar" + (numberOfContests + 1)); + newBarElement.setAttribute("id", "progBar" + numberOfContests); newBarElement.innerHTML = "checkout"; progBarElement.appendChild(newBarElement); const newYrhElement = document.createElement("div"); newYrhElement.setAttribute("class", "yrhSection"); - newYrhElement.setAttribute("id", "yrhBar" + (numberOfContests + 1)); + newYrhElement.setAttribute("id", "yrhBar" + numberOfContests); yrhBarElement.appendChild(newYrhElement); } @@ -155,11 +155,22 @@ } // Will set up the upperSection - function setUpperSection(thisContestName, thisContestValue) { + function setUpperSection(thisContestName=null, thisContestValue=null, checkout=false) { const rootElement = document.getElementById("upperSection"); const newItem = document.createElement("span"); - const max = thisContestValue.max; - if (thisContestValue.tally == "plurality") { + if (checkout) { + // Setup the checkout page + let innerText = `

Ballot Checkout

`; + newItem.innerHTML = innerText; + } else if (thisContestValue.tally == "plurality") { + const max = thisContestValue.max; + // Setup plurality contest header info let innerText = "

" + thisContestName + "

A plurality contest:

"; @@ -168,6 +179,7 @@ } newItem.innerHTML = innerText; } else { + // Setup IRV contest header info innerText = "

" + thisContestName + `

RCV (IRV) contest: