in pysteve/www/htdocs/js/steve_rest.js [926:1110]
function renderElectionBulk(response, el) {
var par = document.getElementById('preloaderWrapper')
par.innerHTML = "";
par.setAttribute("id", "contents")
var title = document.createElement('h1');
title.innerHTML = "Bulk YNA voting for: " + response.base_data.title;
par.appendChild(title);
var issueList = document.createElement('ol');
issueList.setAttribute("class", "issueList")
var s = 0;
var ynas = 0;
response.issues.sort(function(a,b) { return (a.title > b.title)? 1 : -1 } )
bulk_issues = []
for (i in response.issues) {
var issue = response.issues[i]
if (issue.type == "yna") {
bulk_issues.push(issue)
s++;
var outer = document.createElement('li');
// Set style
outer.setAttribute("class", "issueListItemWide")
var no = document.createElement('div');
no.setAttribute("class", "issueNumber")
no.innerHTML = (s)
// Add issue
var inner = document.createElement('span')
inner.setAttribute("id", "inner_yna_" + issue.id)
inner.innerHTML = issue.title;
outer.appendChild(no)
outer.appendChild(inner)
outer.style.height = "32px"
outer.style.marginBottom = "15px"
// details
if (issue.hasVoted) {
outer.setAttribute("style", "margin-bottom: 15px; background: linear-gradient(to bottom, #d8d8d8 0%,#aaaaaa 100%);")
outer.setAttribute("title", "Notice: You have already voted once on this issue")
} else {
outer.setAttribute("title", "You have not yet voted on this issue");
}
var statement = document.createElement('div')
statement.setAttribute("class", "statement_marker")
statement.style.float = "left"
statement.style.marginRight = "15px"
statement.setAttribute("title", "Click to read issue details")
statement.innerHTML = "<a href='#details_"+issue.id+"'>Details</a>"
outer.appendChild(statement)
var popup = document.createElement("div")
popup.setAttribute("class", "modal")
popup.setAttribute("id", "details_" + issue.id)
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>Details about issue #' + issue.id + ": " + issue.title + '</h2><a href="#close" class="btn-close" aria-hidden="true">×</a>'
details = "<b>Nominated by: </b>" + issue.nominatedby + "<br/>"
details += "<b>Seconded by: </b>" + (issue.seconds ? issue.seconds : "no-one") + "<br/>"
details += "<br/><b>Description:<blockquote>" + issue.description + "</blockquote>"
var popupb = document.createElement("div")
popupb.setAttribute("class", "modal-body")
popupb.innerHTML = '<pre>' + details + '</pre>'
var popupf = document.createElement("div")
popupf.setAttribute("class", "modal-footer")
popupf.innerHTML = '<a href="#close" class="btn">Close window</a>'
popupd.appendChild(popuph)
popupd.appendChild(popupb)
popupd.appendChild(popupf)
//document.getElementsByTagName('body')[0].appendChild(popup)
issueList.appendChild(popup)
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", "castVote('" + el[0] + "', '" + issue.id + "', '" + el[1] + "', '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", "castVote('" + el[0] + "', '" + issue.id + "', '" + el[1] + "', '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", "castVote('" + el[0] + "', '" + issue.id + "', '" + el[1] + "', 'a');")
var mark = document.createElement('img');
mark.setAttribute("width", "26")
mark.setAttribute("height", "32")
mark.setAttribute("style", "float: right; margin-left: 10px;")
mark.setAttribute("id", "mark_" + issue.id)
inner.appendChild(mark)
inner.appendChild(no)
inner.appendChild(abstain)
inner.appendChild(yes)
outer.style.animation = "fadein " + (0.5 + (s/6)) + "s"
issueList.appendChild(outer)
}
}
if (bulk_issues.length > 0) {
var warning = document.createElement('div')
warning.setAttribute("id", "bulkvoter")
warning.innerHTML = "<h3>Danger zone: cast bulk vote on remaining issues</h3><p>The buttons below allows you to cast one giant vote on all the issues above that you have not voted on yet. Use with care!</p>"
issueList.appendChild(warning)
var outer = document.createElement('li');
// Set style
outer.setAttribute("class", "issueListItemWide")
var no = document.createElement('div');
no.setAttribute("class", "issueNumber")
no.innerHTML = (s)
// Add bulk txt
var inner = document.createElement('span')
inner.setAttribute("id", "inner_yna_bulk" )
inner.innerHTML = "Bulk vote on the rest:";
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", "castBulkVote('" + el[0] + "', 'bulk', '" + el[1] + "', '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", "castBulkVote('" + el[0] + "', 'bulk', '" + el[1] + "', '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", "castBulkVote('" + el[0] + "', 'bulk', '" + el[1] + "', 'a');")
var mark = document.createElement('img');
mark.setAttribute("width", "26")
mark.setAttribute("height", "32")
mark.setAttribute("style", "float: right; margin-left: 10px;")
mark.setAttribute("id", "mark_bulk")
inner.appendChild(mark)
inner.appendChild(no)
inner.appendChild(abstain)
inner.appendChild(yes)
outer.appendChild(inner)
outer.style.animation = "fadein " + (0.5 + (s/6)) + "s"
issueList.appendChild(outer)
}
par.appendChild(issueList)
}