function displayIssueYNA()

in pysteve/www/htdocs/js/steve_rest.js [1252:1307]


function displayIssueYNA(code, response, state) {
    election_data = response
    var obj = document.getElementById('preloaderWrapper')
    obj.setAttribute("id", "ynavote")
    if (code != 200) {
        obj.innerHTML = "<h1>Could not load issue:</h1><h2>" + response.message + "</h2>";
    } else {
        obj.innerHTML = ""
        
        var title = document.createElement('h2')
        title.innerHTML = response.issue.title;
        obj.appendChild(title)
        
        obj.appendChild(keyvaluepairText("nominatedby", "Put forward (nominated) by:", response.issue.nominatedby))
        obj.appendChild(keyvaluepairText("seconds", "Seconded by:", response.issue.seconds.length > 0 ?  response.issue.seconds.join(", ") : "no-one" ))
        
        var desc = document.createElement('pre')
        desc.setAttribute("class", "statement")
        desc.innerHTML = response.issue.description
        obj.appendChild(desc)
        
        var outer = document.createElement('div')
        outer.setAttribute("class", "issueListItem")
        
        var yes = document.createElement('input')
        yes.setAttribute("type", "button")
        yes.setAttribute("value", "Yes")
        yes.setAttribute("class", "btn-green")
        yes.setAttribute("style", "float: right;");
        yes.setAttribute("onclick", "castSingleVote('y');")
        
        var no = document.createElement('input')
        no.setAttribute("type", "button")
        no.setAttribute("value", "No")
        no.setAttribute("class", "btn-red")
        no.setAttribute("style", " float: right;");
        no.setAttribute("onclick", "castSingleVote('n');")
        
        var abstain = document.createElement('input')
        abstain.setAttribute("type", "button")
        abstain.setAttribute("value", "Abstain")
        abstain.setAttribute("class", "btn-yellow")
        abstain.setAttribute("style", "float: right;");
        abstain.setAttribute("onclick", "castSingleVote('a');")
        
        var p = document.createElement('p')
        p.innerHTML = "Cast your vote by clicking on the respective button below. You may recast your vote as many time as you like, should you reconsider."
        
        obj.appendChild(p)
        outer.appendChild(no)
        outer.appendChild(abstain)
        outer.appendChild(yes)
        
        obj.appendChild(outer)
    }
}