function drawCandidatesDH()

in pysteve/www/htdocs/js/steve_dh.js [71:140]


function drawCandidatesDH() {
    var box = document.getElementById('candidates')
    box.innerHTML = "<h3>Candidates:</h3>"
    for (i in candidates) {
        var name = candidates[i]
        var char = chars[i]
        // Add element and set drag'n'drop + data
        var li = document.createElement('li')
        var outer = document.createElement('div')
        var inner = document.createElement('span')
        inner.style.fontFamily = "monospace"
        inner.innerHTML = char + ": " + name;
        inner.setAttribute("ondrop", "dropCandidate(event, true)")
        outer.setAttribute("class", "ballotbox_clist_DH")
        if (char == vote_DH) {
            outer.setAttribute("class", "ballotbox_clist_selectedDH")
        }
        outer.setAttribute("id", name)
        outer.setAttribute("onclick", "vote_DH = '"+char+"'; drawCandidatesDH();")
        outer.appendChild(inner)
        outer.setAttribute("title", "Click to select "  + name + " as your preference")
        li.appendChild(outer)
        // Does the candidate have a statement? if so, put it on there
        if (statements[char]) {
            var statement = document.createElement('div')
            statement.setAttribute("class", "statement_marker")
            statement.setAttribute("title", "Click to read " + name + "'s statement")
            statement.innerHTML = "<a href='#statement_"+char+"'>Statement</a>"
            
            li.appendChild(statement)
            
            var popup = document.createElement("div")
            popup.setAttribute("class", "modal")
            popup.setAttribute("id", "statement_" + char)
            popup.setAttribute("aria-hidden", "true")
            
            var popupd = document.createElement("div")
            popupd.setAttribute("class", "modal-dialog")
            popup.appendChild(popupd)
            
            var popuph = document.createElement("div")
            popuph.setAttribute("class", "modal-header")
            popuph.innerHTML = '<h2>Statement from ' + name + '</h2><a href="#close" class="btn-close" aria-hidden="true">�</a>'
            
            var popupb = document.createElement("div")
            popupb.setAttribute("class", "modal-body")
            popupb.innerHTML = '<pre>' + (statements[char] ? statements[char] : "This candidate has not prepared a statement") +'</pre>'
            
            var popupf = document.createElement("div")
            popupf.setAttribute("class", "modal-footer")
            popupf.innerHTML = '<a href="#close" class="btn">Close statement</a>'
            
            popupd.appendChild(popuph)
            popupd.appendChild(popupb)
            popupd.appendChild(popupf)
            
            document.getElementsByTagName('body')[0].appendChild(popup)
        }/* else {
            var statement = document.createElement('div')
            statement.setAttribute("class", "statement_marker")
            statement.style = "background: linear-gradient(to bottom, #e2e2e2 0%,#dbdbdb 50%,#d1d1d1 51%,#fefefe 100%) !important;"
            statement.style.color = "#666";
            statement.innerHTML = "<i>No statement</i>"

            outer.appendChild(statement)
        }*/
        box.appendChild(li)
        
    }
}