Skip to content
Snippets Groups Projects
Commit b01bd0e7 authored by Otto Zaiser's avatar Otto Zaiser
Browse files

Makeup y deprecated code

parent 54cb378e
No related branches found
No related tags found
No related merge requests found
...@@ -190,3 +190,8 @@ button.toggle-button{ ...@@ -190,3 +190,8 @@ button.toggle-button{
height: 10px; height: 10px;
width: 10px; width: 10px;
} }
.hash {
word-wrap: break-word;
}
\ No newline at end of file
...@@ -30,6 +30,10 @@ ...@@ -30,6 +30,10 @@
.navbar-vote.navbar-fondo { .navbar-vote.navbar-fondo {
.vote-status { .vote-status {
margin-top: 8px; margin-top: 8px;
@media (max-width: 375px){
margin-top: 15px;
}
} }
} }
......
This diff is collapsed.
...@@ -33,24 +33,24 @@ ...@@ -33,24 +33,24 @@
<div id="voterow" class="row hide"> <div id="voterow" class="row hide">
<section> <section>
<h1 class="page-header">Votación</h1> <h1 class="page-header">Votación</h1>
<a class="btn-default btn btn-lg btn-header btn-new" aria-label="Crear nueva votación" href="smartNewvote.html"> <a class="btn-default btn btn-lg btn-header btn-new" aria-label="Crear nueva votación" href="./nueva/">
<span class="hidden-xs">Crear nueva votación</span> <span class="hidden-xs">Crear nueva votación</span>
<span class="visible-xs"> <span class="visible-xs">
<i class="fas fa-plus" aria-hidden="true"></i> <i class="fas fa-plus" aria-hidden="true"></i>
</span> </span>
</a> </a>
<form action="smartVotar.html"> <form action="./votar/">
<div class="alert alert-danger" role="alert" id="errorForm"> <div class="alert alert-danger" style="display: none" role="alert" id="errorForm">
<p>Comprobá los siguientes errores del formulario:</p> <p>Comprobá los siguientes errores del formulario:</p>
<ul></ul> <ul></ul>
</div> </div>
<div class="form-group form-group-lg col-sm-12"> <div class="form-group form-group-lg col-sm-12">
<label for="input_address" class="form-required">Dirección de la votación</label> <label for="vote_address" class="form-required">Dirección de la votación</label>
<input class="form-control" type="text" id="input_address" name="input_address" value="" size="40" <input class="form-control" type="text" id="vote_address" name="vote_address" value="" size="40"
minlength="42" maxlength="42" required="required" aria-required="true" placeholder="42 caracteres hex (debe empezar con 0x)"> minlength="42" maxlength="42" required="required" aria-required="true" placeholder="42 caracteres hex (debe empezar con 0x)">
</div> </div>
<div class="form-group col-sm-6 col-sm-push-6"> <div class="form-group col-sm-6 col-sm-push-6">
<button class="btn-primary btn btn-block" type="submit" id="submit">Ver votación</button> <button class="btn-primary btn btn-lg btn-block" type="submit" id="submit">Ver votación</button>
</div> </div>
</form> </form>
</section> </section>
...@@ -66,8 +66,6 @@ ...@@ -66,8 +66,6 @@
<h2>Redes Sociales</h2> <h2>Redes Sociales</h2>
<div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item">
<ul> <ul>
<li><a href="https://www.facebook.com/bfa.ar" target="_blank"><i class="fab fa-facebook-f fa-2x"
aria-hidden="true"></i><span class="sr-only">Facebook</span></a></li>
<li><a href="https://www.twitter.com/bfa_ar" target="_blank"><i class="fab fa-twitter fa-2x" <li><a href="https://www.twitter.com/bfa_ar" target="_blank"><i class="fab fa-twitter fa-2x"
aria-hidden="true"></i><span class="sr-only">Twitter</span></a></li> aria-hidden="true"></i><span class="sr-only">Twitter</span></a></li>
<li><a href="https://www.instagram.com/bfa_ar" target="_blank"><i class="fab fa-instagram fa-2x" <li><a href="https://www.instagram.com/bfa_ar" target="_blank"><i class="fab fa-instagram fa-2x"
...@@ -109,20 +107,20 @@ ...@@ -109,20 +107,20 @@
unhighlight: function (element) { unhighlight: function (element) {
$(element).closest('.form-group').removeClass('has-error'); $(element).closest('.form-group').removeClass('has-error');
}, },
submitHandler: function (form) { // submitHandler: function (form) {
// do other things for a valid form // // do other things for a valid form
form.submit(); // form.submit();
//ver_votacion(''); // //ver_votacion2('');
}, // },
messages: { messages: {
input_address: { vote_address: {
required: "Ingresá una dirección válida", required: "Ingresá una dirección válida",
minlength: "La dirección debe tener 42 caractéres incluidos el 0x.", minlength: "La dirección debe tener 42 caractéres incluidos el 0x.",
maxlength: "La dirección debe tener 42 caractéres incluidos el 0x." maxlength: "La dirección debe tener 42 caractéres incluidos el 0x."
} }
}, },
rules: { rules: {
input_address: { vote_address: {
required: true, required: true,
minlength: 42, minlength: 42,
maxlength: 42 maxlength: 42
......
...@@ -15,73 +15,76 @@ var netnames = { ...@@ -15,73 +15,76 @@ var netnames = {
"3": 'ropsten test', "3": 'ropsten test',
"4": 'Rinkeby test', "4": 'Rinkeby test',
'42': 'Kovan test', '42': 'Kovan test',
'5445': 'BFA test', '5445': 'BFA test', //Red que no está sellando
'55555000000': 'BFA test2',
'47525974938': 'Blockchain Federal Argentina', '47525974938': 'Blockchain Federal Argentina',
'5777': 'Ganache - Local' '5777': 'Ganache - Local'
}; };
var mainaddr = { var mainaddr = {
'5445': '0xe5bf7c3e8aa529e42fbd99428137b68db75d85f9', '5445': '0xe5bf7c3e8aa529e42fbd99428137b68db75d85f9',
'47525974938': '0xe3e08934b6fa0b68972c08e0f545cee31ed039c6', '55555000000': '0xe5bf7c3e8aa529e42fbd99428137b68db75d85f9', // Smart contract
'47525974938': '0xe3e08934b6fa0b68972c08e0f545cee31ed039c6',
'5777': '0xB1427B0147175ea6c6e35eA8c258b7e844ECa66A' '5777': '0xB1427B0147175ea6c6e35eA8c258b7e844ECa66A'
}; };
var contract_event; var contract_event;
// Deprecated /// DEPRECATED ///
var ballot_keccak3 = '0x27fdf9b1c0d27b6143d49147cf30b3f7f09ac1c2cb2b7115a1633e0b8551c6a9'; var ballot_keccak3 = '0x27fdf9b1c0d27b6143d49147cf30b3f7f09ac1c2cb2b7115a1633e0b8551c6a9';
window.addEventListener('load', page_loaded); window.addEventListener('load', page_loaded);
function addchild(parent, childtype, childText, attributes) { /// DEPRECATED ///
var childNode = document.createElement(childtype); // function addchild(parent, childtype, childText, attributes) {
if (typeof childText == 'string') { // var childNode = document.createElement(childtype);
var childTextNode = document.createTextNode(childText); // if (typeof childText == 'string') {
childNode.appendChild(childTextNode); // var childTextNode = document.createTextNode(childText);
} // childNode.appendChild(childTextNode);
if (attributes) { // }
for (var att in attributes) // if (attributes) {
childNode.setAttribute(att, attributes[att]); // for (var att in attributes)
} // childNode.setAttribute(att, attributes[att]);
parent.appendChild(childNode); // }
return childNode; // parent.appendChild(childNode);
} // return childNode;
// }
// DEPRECATED
function ask_about_contract_address() { function ask_about_contract_address() {
document.getElementById('status').classList.remove("hide"); document.getElementById('status').classList.remove("hide");
document.getElementById('voterow').classList.remove("hide"); document.getElementById('voterow').classList.remove("hide");
} }
// DEPRECATED
function update_create_new_ballot() { // function update_create_new_ballot() {
// Find our div (if it exists). // // Find our div (if it exists).
var div = document.getElementById('div_create_ballot'); // var div = document.getElementById('div_create_ballot');
if (!div) // if (!div)
return; // return;
// Don't change anything, if we are in the middle of creating a new contract. // // Don't change anything, if we are in the middle of creating a new contract.
if (document.getElementById('newcontract')) // if (document.getElementById('newcontract'))
return; // return;
// See if we already have the form inside the div // // See if we already have the form inside the div
if (!document.getElementById('nueva_link')) { // if (!document.getElementById('nueva_link')) {
addchild(div, 'span', 'o tal vez querés '); // addchild(div, 'span', 'o tal vez querés ');
addchild(div, 'a', 'crear una votación nueva', { // addchild(div, 'a', 'crear una votación nueva', {
'href': 'javascript:ask_for_ballot_details()', // 'href': 'javascript:ask_for_ballot_details()',
'id': 'nueva_link' // 'id': 'nueva_link'
}); // });
addchild(div, 'span', '?'); // addchild(div, 'span', '?');
} // }
if (mainaddr[netid] == undefined) { // if (mainaddr[netid] == undefined) {
// if we do not have the address of the mother contract, we will // // if we do not have the address of the mother contract, we will
// not present the user with a choice to create a new form. // // not present the user with a choice to create a new form.
div.setAttribute('class', 'hidden'); // div.setAttribute('class', 'hidden');
return; // return;
} // }
div.removeAttribute('class'); // div.removeAttribute('class');
} // }
async function page_loaded() { async function page_loaded() {
var body = document.getElementsByTagName("body")[0]; // var body = document.getElementsByTagName("body")[0];
rootdiv = addchild(body, 'div', undefined, { // rootdiv = addchild(body, 'div', undefined, {
'id': 'root' // 'id': 'root'
}); // });
const Web3 = require('web3'); const Web3 = require('web3');
// post Nov 2018 this works // post Nov 2018 this works
if (window.ethereum) { if (window.ethereum) {
...@@ -110,7 +113,7 @@ async function page_loaded() { ...@@ -110,7 +113,7 @@ async function page_loaded() {
} }
// wow, all okay // wow, all okay
// add more UI elements // add more UI elements
console.log('window.web3.version.api is ' + window.web3.version.api); //console.log('window.web3.version.api is ' + window.web3.version.api);
ask_about_contract_address(); ask_about_contract_address();
//addchild( rootdiv, 'hr', undefined, {'width':'20%'} ); //addchild( rootdiv, 'hr', undefined, {'width':'20%'} );
...@@ -121,22 +124,23 @@ async function page_loaded() { ...@@ -121,22 +124,23 @@ async function page_loaded() {
}); });
addchild(rootdiv, 'div', undefined, { // addchild(rootdiv, 'div', undefined, {
'id': 'div_create_ballot', // 'id': 'div_create_ballot',
'class': 'hidden' // 'class': 'hidden'
}); // });
update_create_new_ballot(); // update_create_new_ballot();
get_status(); get_status();
timer = setInterval(get_status, 1000); timer = setInterval(get_status, 1000);
} }
function deleteAllChildren(node) { /// DEPRECATED ///
node.children.forEach( // function deleteAllChildren(node) {
function (item, idx) { // node.children.forEach(
node.removeChild(item); // function (item, idx) {
} // node.removeChild(item);
); // }
} // );
// }
async function get_netid() { async function get_netid() {
window.web3.version.getNetwork( window.web3.version.getNetwork(
...@@ -202,7 +206,7 @@ function update_status_display() { ...@@ -202,7 +206,7 @@ function update_status_display() {
div.parent.removeChild(div); div.parent.removeChild(div);
} else } else
div.innerHTML = info.join('<br/>'); div.innerHTML = info.join('<br/>');
update_create_new_ballot() //update_create_new_ballot()
} }
function api_version() { function api_version() {
...@@ -235,168 +239,171 @@ function setup_existing_instance(abi, addr) { ...@@ -235,168 +239,171 @@ function setup_existing_instance(abi, addr) {
return; return;
} }
function add_proposal(pos) { /// DEPRECATED ///
var div = document.getElementById('newtable'); // function add_proposal(pos) {
if (!div) // var div = document.getElementById('newtable');
return; // if (!div)
var len = div.children.length; // return;
// // var len = div.children.length;
var newnode = document.createElement('tr'); // //
newnode.setAttribute('class', 'proposal'); // var newnode = document.createElement('tr');
// We add/adjust text and attribs afterwards // newnode.setAttribute('class', 'proposal');
var td1 = addchild(newnode, 'td'); // // We add/adjust text and attribs afterwards
var td2 = addchild(newnode, 'td'); // var td1 = addchild(newnode, 'td');
addchild(td2, 'input'); // var td2 = addchild(newnode, 'td');
var idx = 0; // addchild(td2, 'input');
for (var i = 0; i < div.children.length; i++) { // var idx = 0;
if (div.children[i].getAttribute('class') == 'proposal') { // for (var i = 0; i < div.children.length; i++) {
idx++; // if (div.children[i].getAttribute('class') == 'proposal') {
if (newnode) { // idx++;
if (pos == idx) { // if (newnode) {
div.insertBefore(newnode, div.children[i - 1]); // if (pos == idx) {
newnode = undefined; // div.insertBefore(newnode, div.children[i - 1]);
} // newnode = undefined;
} // }
} // }
} // }
if (newnode && idx < 10) // }
div.insertBefore(newnode, div.lastChild); // if (newnode && idx < 10)
// Fix numbering // div.insertBefore(newnode, div.lastChild);
idx = 0; // // Fix numbering
for (var i = 0; i < div.children.length; i++) { // idx = 0;
if (div.children[i].getAttribute('class') == 'proposal') { // for (var i = 0; i < div.children.length; i++) {
idx++; // if (div.children[i].getAttribute('class') == 'proposal') {
div.children[i].children[0].innerHTML = 'Proposal ' + idx; // idx++;
div.children[i].children[1].children[0].setAttribute('name', 'proposal' + idx); // div.children[i].children[0].innerHTML = 'Proposal ' + idx;
} // div.children[i].children[1].children[0].setAttribute('name', 'proposal' + idx);
} // }
} // }
// }
async function ask_for_ballot_details() {
if (mainaddr[netid] == undefined)
return; /// DEPRECATED ///
if (abiNew == undefined) // async function ask_for_ballot_details() {
return // if (mainaddr[netid] == undefined)
if (abiNew == '') // return;
return; // if (abiNew == undefined)
// // return
var otherdiv; // if (abiNew == '')
if (otherdiv = document.getElementById('div_create_ballot')) // return;
otherdiv.setAttribute('class', 'hidden'); // //
// // var otherdiv;
// Our territory starts here // if (otherdiv = document.getElementById('div_create_ballot'))
// // otherdiv.setAttribute('class', 'hidden');
var newdiv = addchild(rootdiv, 'div', undefined, { // //
'id': 'newcontract' // // Our territory starts here
}); // //
// Create form. // var newdiv = addchild(rootdiv, 'div', undefined, {
var form = addchild(newdiv, 'form', undefined, { // 'id': 'newcontract'
'id': 'form_create_new_ballot', // });
'action': 'javascript:nueva_votacion()' // // Create form.
}); // var form = addchild(newdiv, 'form', undefined, {
var table = addchild(form, 'table', undefined, { // 'id': 'form_create_new_ballot',
'id': 'newtable' // 'action': 'javascript:nueva_votacion()'
}); // });
// Title // var table = addchild(form, 'table', undefined, {
var tr = addchild(table, 'tr'); // 'id': 'newtable'
addchild(tr, 'td', 'Title'); // });
addchild( // // Title
addchild(tr, 'td'), // var tr = addchild(table, 'tr');
'input', undefined, { // addchild(tr, 'td', 'Title');
'name': 'title' // addchild(
} // addchild(tr, 'td'),
); // 'input', undefined, {
// Vote Starts // 'name': 'title'
tr = addchild(table, 'tr'); // }
addchild(tr, 'td', 'Vote starts'); // );
addchild( // // Vote Starts
addchild(tr, 'td'), // tr = addchild(table, 'tr');
'input', undefined, { // addchild(tr, 'td', 'Vote starts');
'name': 'voteStarts' // addchild(
} // addchild(tr, 'td'),
); // 'input', undefined, {
// Vote Before // 'name': 'voteStarts'
tr = addchild(table, 'tr'); // }
addchild(tr, 'td', 'Vote before'); // );
addchild( // // Vote Before
addchild(tr, 'td'), // tr = addchild(table, 'tr');
'input', undefined, { // addchild(tr, 'td', 'Vote before');
'name': 'voteBefore' // addchild(
} // addchild(tr, 'td'),
); // 'input', undefined, {
// % of registered voters req to be valid // 'name': 'voteBefore'
tr = addchild(table, 'tr'); // }
addchild(tr, 'td', 'Percent of registered voters must vote for the result to be valid'); // );
addchild( // // % of registered voters req to be valid
addchild(tr, 'td'), // tr = addchild(table, 'tr');
'input', undefined, { // addchild(tr, 'td', 'Percent of registered voters must vote for the result to be valid');
'name': 'percentOfRegisteredVotersReqToBeValid', // addchild(
'value': '0.000001' // addchild(tr, 'td'),
} // 'input', undefined, {
); // 'name': 'percentOfRegisteredVotersReqToBeValid',
// % of votes cast to win // 'value': '0.000001'
tr = addchild(table, 'tr'); // }
addchild(tr, 'td', 'Percent of votes cast to win'); // );
addchild( // // % of votes cast to win
addchild(tr, 'td'), // tr = addchild(table, 'tr');
'input', undefined, { // addchild(tr, 'td', 'Percent of votes cast to win');
'name': 'percentOfVotesCastToWin', // addchild(
'value': '50.000001' // addchild(tr, 'td'),
} // 'input', undefined, {
); // 'name': 'percentOfVotesCastToWin',
// Count non-votes as blanks // 'value': '50.000001'
tr = addchild(table, 'tr'); // }
addchild(tr, 'td', 'Count non-votes as blanks'); // );
var select = addchild( // // Count non-votes as blanks
addchild(tr, 'td'), // tr = addchild(table, 'tr');
'select', undefined, { // addchild(tr, 'td', 'Count non-votes as blanks');
'name': 'countNonvotesAsBlanks' // var select = addchild(
} // addchild(tr, 'td'),
); // 'select', undefined, {
addchild(select, 'option', undefined, { // 'name': 'countNonvotesAsBlanks'
'value': 'Yes' // }
}).innerHTML = 'Si / Yes'; // );
addchild(select, 'option', undefined, { // addchild(select, 'option', undefined, {
'value': 'No' // 'value': 'Yes'
}).innerHTML = 'No'; // }).innerHTML = 'Si / Yes';
// Max votes per voter // addchild(select, 'option', undefined, {
tr = addchild(table, 'tr'); // 'value': 'No'
addchild(tr, 'td', 'Maximum number of votes per voter'); // }).innerHTML = 'No';
addchild( // // Max votes per voter
addchild(tr, 'td'), // tr = addchild(table, 'tr');
'input', undefined, { // addchild(tr, 'td', 'Maximum number of votes per voter');
'name': 'maxVotesPerVoter', // addchild(
'value': '1' // addchild(tr, 'td'),
} // 'input', undefined, {
); // 'name': 'maxVotesPerVoter',
// Max votes per proposal // 'value': '1'
tr = addchild(table, 'tr'); // }
addchild(tr, 'td', 'Maximum number of votes per proposal'); // );
addchild( // // Max votes per proposal
addchild(tr, 'td'), // tr = addchild(table, 'tr');
'input', undefined, { // addchild(tr, 'td', 'Maximum number of votes per proposal');
'name': 'maxVotesPerProposal', // addchild(
'value': '1' // addchild(tr, 'td'),
} // 'input', undefined, {
); // 'name': 'maxVotesPerProposal',
// more mas extra // 'value': '1'
tr = addchild(table, 'tr'); // }
addchild( // );
addchild(tr, 'td', undefined, { // // more mas extra
'colspan': '2' // tr = addchild(table, 'tr');
}), // addchild(
'a', '[ + extra proposal ]', { // addchild(tr, 'td', undefined, {
'href': 'javascript:add_proposal(999)' // 'colspan': '2'
}); // }),
// Proposals // 'a', '[ + extra proposal ]', {
add_proposal(1); // 'href': 'javascript:add_proposal(999)'
// // });
// submit button to create a new ballot // // Proposals
addchild(form, 'input', undefined, { // add_proposal(1);
'type': 'submit', // //
'value': 'Crear nueva' // // submit button to create a new ballot
}); // addchild(form, 'input', undefined, {
} // 'type': 'submit',
// 'value': 'Crear nueva'
// });
// }
async function nueva_votacion(arguments, proposals, voters) { async function nueva_votacion(arguments, proposals, voters) {
if (mainaddr[netid] == undefined) if (mainaddr[netid] == undefined)
...@@ -406,9 +413,9 @@ async function nueva_votacion(arguments, proposals, voters) { ...@@ -406,9 +413,9 @@ async function nueva_votacion(arguments, proposals, voters) {
proposals[i] = web3.fromAscii(proposals[i]); proposals[i] = web3.fromAscii(proposals[i]);
} }
alertarLoading('Trying to access your account.'); alertarLoading('Tratando de acceder a tu cuenta.');
await access_accounts(); await access_accounts();
alertarLoading('Creating new voting contract.'); alertarLoading('Creando un nuevo contrato de votación.');
var contract = setup_existing_contract(abiNew, mainaddr[netid]); var contract = setup_existing_contract(abiNew, mainaddr[netid]);
if (!contract) if (!contract)
...@@ -446,7 +453,7 @@ async function ver_votacion(addr) { ...@@ -446,7 +453,7 @@ async function ver_votacion(addr) {
if (addr == "") if (addr == "")
addr = addr =
document document
.getElementById('input_address') .getElementById('vote_address')
.value; .value;
alertarLoading('Cargando detalles del contrato...'); alertarLoading('Cargando detalles del contrato...');
if (addr && addr.length == 40) if (addr && addr.length == 40)
...@@ -463,13 +470,17 @@ async function ver_votacion(addr) { ...@@ -463,13 +470,17 @@ async function ver_votacion(addr) {
async function ver_votacion2(addr, code) { async function ver_votacion2(addr, code) {
console.log('Contract code', code); console.log('Contract code', code);
if (code == '0x') { if (code == '0x') {
alertar('No existe un contrato con esa dirección'); alertar('No existe un contrato con esa dirección');
$('#titulo_votacion').text('Error');
return; return;
}else{
document.getElementById('vote-content').classList.add("show");
} }
var keccak3 = window.web3.sha3(code, { var keccak3 = window.web3.sha3(code, {
'encoding': 'hex' 'encoding': 'hex'
}); });
console.log('keccak3: ', keccak3); //console.log('keccak3: ', keccak3);
/*if (keccak3 != ballot_keccak3) { /*if (keccak3 != ballot_keccak3) {
alertar('No hay una votación en esa dirección.'); alertar('No hay una votación en esa dirección.');
return; return;
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Nueva Votación | Blockchain Federal Argentina</title> <title>Nueva Votación | Blockchain Federal Argentina</title>
<link rel="shortcut icon" href="favicon.ico" /> <link rel="shortcut icon" href="../favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous"> crossorigin="anonymous">
<link rel="stylesheet" type="text/css" media="screen" href="css/vendor.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../css/vendor.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/main.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../css/main.css" />
</head> </head>
<body> <body>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<div class="navbar-header"> <div class="navbar-header">
<div class="region region-navigation"> <div class="region region-navigation">
<a class="logo navbar-btn pull-left" href="https://bfa.ar/" rel="home"> <a class="logo navbar-btn pull-left" href="https://bfa.ar/" rel="home">
<img id="logo" src="./images/logo.svg" alt="Blockchain Federal Argentina"> <img id="logo" src="../images/logo.svg" alt="Blockchain Federal Argentina">
</a> </a>
<div class="vote-status hide" id="status"></div> <div class="vote-status hide" id="status"></div>
</div> </div>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<section> <section>
<h1 class="page-header">Nueva Votación</h1> <h1 class="page-header">Nueva Votación</h1>
<form action="" id="form_create_new_ballot"> <form action="" id="form_create_new_ballot">
<div class="alert alert-danger" role="alert" id="errorForm"> <div class="alert alert-danger" style="display: none" role="alert" id="errorForm">
<p>Comprobá los siguientes errores del formulario:</p> <p>Comprobá los siguientes errores del formulario:</p>
<ul></ul> <ul></ul>
</div> </div>
...@@ -160,10 +160,10 @@ ...@@ -160,10 +160,10 @@
</div> </div>
<div class="row"> <div class="row">
<div class="form-group col-sm-6 col-sm-push-6 form-footer"> <div class="form-group col-sm-6 col-sm-push-6 form-footer">
<button class="btn-primary btn btn-block" type="submit" id="submit">Crear votación</button> <button class="btn-primary btn btn-lg btn-block" type="submit" id="submit">Crear votación</button>
</div> </div>
<div class="form-group form-group-lg col-sm-6 col-sm-pull-6 font_small form-footer"> <div class="form-group form-group-lg col-sm-6 col-sm-pull-6 font_small form-footer">
<a class="btn-default btn btn-lg btn-block" href="smartVote.html">Cancelar</a> <a class="btn-default btn btn-lg btn-block" href="../">Cancelar</a>
</div> </div>
</div> </div>
</form> </form>
...@@ -180,8 +180,6 @@ ...@@ -180,8 +180,6 @@
<h2>Redes Sociales</h2> <h2>Redes Sociales</h2>
<div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item">
<ul> <ul>
<li><a href="https://www.facebook.com/bfa.ar" target="_blank"><i class="fab fa-facebook-f fa-2x"
aria-hidden="true"></i><span class="sr-only">Facebook</span></a></li>
<li><a href="https://www.twitter.com/bfa_ar" target="_blank"><i class="fab fa-twitter fa-2x" <li><a href="https://www.twitter.com/bfa_ar" target="_blank"><i class="fab fa-twitter fa-2x"
aria-hidden="true"></i><span class="sr-only">Twitter</span></a></li> aria-hidden="true"></i><span class="sr-only">Twitter</span></a></li>
<li><a href="https://www.instagram.com/bfa_ar" target="_blank"><i class="fab fa-instagram fa-2x" <li><a href="https://www.instagram.com/bfa_ar" target="_blank"><i class="fab fa-instagram fa-2x"
...@@ -201,12 +199,12 @@ ...@@ -201,12 +199,12 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="js/vendor/font-awesome531.js"></script> <script src="../js/vendor/font-awesome531.js"></script>
<script src="js/vendor/jquery.validate.js"></script> <script src="../js/vendor/jquery.validate.js"></script>
<script src="js/main.js"></script> <script src="../js/main.js"></script>
<script src="js/vendor/web3.js"></script> <script src="../js/vendor/web3.js"></script>
<script src="js/vendor/abi.js"></script> <script src="../js/vendor/abi.js"></script>
<script src="js/vendor/ballot.js"></script> <script src="../js/vendor/ballot.js"></script>
<script> <script>
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Votar | Blockchain Federal Argentina</title> <title>Votar | Blockchain Federal Argentina</title>
<link rel="shortcut icon" href="favicon.ico" /> <link rel="shortcut icon" href="../favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous"> crossorigin="anonymous">
<link rel="stylesheet" type="text/css" media="screen" href="css/vendor.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../css/vendor.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/main.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../css/main.css" />
</head> </head>
<body> <body>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<div class="navbar-header"> <div class="navbar-header">
<div class="region region-navigation"> <div class="region region-navigation">
<a class="logo navbar-btn pull-left" href="https://bfa.ar/" rel="home"> <a class="logo navbar-btn pull-left" href="https://bfa.ar/" rel="home">
<img id="logo" src="./images/logo.svg" alt="Blockchain Federal Argentina"> <img id="logo" src="../images/logo.svg" alt="Blockchain Federal Argentina">
</a> </a>
<div class="vote-status hide" id="status"></div> <div class="vote-status hide" id="status"></div>
</div> </div>
...@@ -32,65 +32,67 @@ ...@@ -32,65 +32,67 @@
<div id="alert-wrapper"></div> <div id="alert-wrapper"></div>
<div id="voterow" class="row hide"> <div id="voterow" class="row hide">
<section> <section>
<h1 class="page-header" id="titulo_votacion">Título de la votación</h1> <h1 class="page-header" id="titulo_votacion"></h1>
<p class="max-container"><b>Dirección:</b> <span id="contract_address">0xe3e08934b6fa0b68972c08e0f545cee31ed039</span> <p class="max-container"><b>Dirección:</b> <span id="contract_address" class="hash"></span>
<a class="btn-default btn btn-lg btn-address" aria-label="Cambiar dirección" href="index.html"> <a class="btn-default btn btn-lg btn-address" aria-label="Cambiar dirección" href="../">
Cambiar Cambiar
</a> </a>
</p> </p>
<p class="max-container"> <div id="vote-content" style="display: none;">
<b>Comienza:</b> <span id="comienza_votacion"></span><br /> <p class="max-container">
<b>Termina:</b> <span id="termina_votacion"></span> <b>Comienza:</b> <span id="comienza_votacion"></span><br />
</p> <b>Termina:</b> <span id="termina_votacion"></span>
<div class="resultados" style="display: none;" id="results"> </p>
<h2>Resultados</h2> <div class="resultados" style="display: none;" id="results">
<h2>Resultados</h2>
<!--<h2>Detalle de la votación</h2>
<table class="table table-hover"> <!--<h2>Detalle de la votación</h2>
<thead> <table class="table table-hover">
<tr> <thead>
<th>#</th> <tr>
<th>Nombre</th> <th>#</th>
<th>Correo</th> <th>Nombre</th>
<th>Opción votada</th> <th>Correo</th>
</tr> <th>Opción votada</th>
</thead> </tr>
<tbody> </thead>
<tr> <tbody>
<th scope="row">1</th> <tr>
<td>Mark</td> <th scope="row">1</th>
<td>mark@bfa.ar</td> <td>Mark</td>
<td>1</td> <td>mark@bfa.ar</td>
</tr> <td>1</td>
<tr> </tr>
<th scope="row">2</th> <tr>
<td>Clara</td> <th scope="row">2</th>
<td>Clara@bfa.ar</td> <td>Clara</td>
<td>1</td> <td>Clara@bfa.ar</td>
</tr> <td>1</td>
<tr> </tr>
<th scope="row">3</th> <tr>
<td>David</td> <th scope="row">3</th>
<td>David@bfa.ar</td> <td>David</td>
<td>1</td> <td>David@bfa.ar</td>
</tr> <td>1</td>
</tbody> </tr>
</tbody>
</table>-->
</table>-->
</div>
<form action="" id="form_votacion">
<div class="alert alert-danger" role="alert" id="errorForm">
<p>Comprobá los siguientes errores del formulario:</p>
<ul></ul>
</div> </div>
<fieldset class="form-group votar" id="proposals"> <form action="" id="form_votacion">
<legend>Opciones para votar</legend> <div class="alert alert-danger" style="display: none" role="alert" id="errorForm">
</fieldset> <p>Comprobá los siguientes errores del formulario:</p>
<div class="form-group col-sm-6 col-sm-push-6"> <ul></ul>
<button class="btn-primary btn btn-block" type="submit" id="submit">Votar</button> </div>
</div> <fieldset class="form-group votar" id="proposals">
</form> <legend>Opciones para votar</legend>
</fieldset>
<div class="form-group col-sm-6 col-sm-push-6">
<button class="btn-primary btn btn-block" type="submit" id="submit">Votar</button>
</div>
</form>
</div>
<div class="clearfix"></div> <div class="clearfix"></div>
</section> </section>
</div> </div>
...@@ -105,8 +107,6 @@ ...@@ -105,8 +107,6 @@
<h2>Redes Sociales</h2> <h2>Redes Sociales</h2>
<div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item">
<ul> <ul>
<li><a href="https://www.facebook.com/bfa.ar" target="_blank"><i class="fab fa-facebook-f fa-2x"
aria-hidden="true"></i><span class="sr-only">Facebook</span></a></li>
<li><a href="https://www.twitter.com/bfa_ar" target="_blank"><i class="fab fa-twitter fa-2x" <li><a href="https://www.twitter.com/bfa_ar" target="_blank"><i class="fab fa-twitter fa-2x"
aria-hidden="true"></i><span class="sr-only">Twitter</span></a></li> aria-hidden="true"></i><span class="sr-only">Twitter</span></a></li>
<li><a href="https://www.instagram.com/bfa_ar" target="_blank"><i class="fab fa-instagram fa-2x" <li><a href="https://www.instagram.com/bfa_ar" target="_blank"><i class="fab fa-instagram fa-2x"
...@@ -126,12 +126,12 @@ ...@@ -126,12 +126,12 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="js/vendor/font-awesome531.js"></script> <script src="../js/vendor/font-awesome531.js"></script>
<script src="js/vendor/jquery.validate.js"></script> <script src="../js/vendor/jquery.validate.js"></script>
<script src="js/main.js"></script> <script src="../js/main.js"></script>
<script src="js/vendor/web3.js"></script> <script src="../js/vendor/web3.js"></script>
<script src="js/vendor/abi.js"></script> <script src="../js/vendor/abi.js"></script>
<script src="js/vendor/ballot.js"></script> <script src="../js/vendor/ballot.js"></script>
<script> <script>
...@@ -139,21 +139,21 @@ ...@@ -139,21 +139,21 @@
var url = new URL(window.location.href); var url = new URL(window.location.href);
var input_address = url.searchParams.get("input_address"); var vote_address = url.searchParams.get("vote_address");
if(typeof input_address != "undefined" && input_address != ""){ if(typeof vote_address != "undefined" && vote_address != ""){
$("#contract_address").text(input_address); $("#contract_address").text(vote_address);
ver_votacion(input_address); ver_votacion(vote_address);
//TEST showing the results bargraph //TEST showing the results bargraph
//$(".resultados").show(); //$(".resultados").show();
//resultados(input_address); //resultados(vote_address);
} }
function viewVotacion(){ function viewVotacion(){
$("form").hide(); $("form").hide();
$(".resultados").show(); $(".resultados").show();
resultados(input_address); resultados(vote_address);
} }
async function sendVotacion(){ async function sendVotacion(){
...@@ -163,9 +163,9 @@ ...@@ -163,9 +163,9 @@
try{ try{
if(typeof input_address != "undefined" && input_address != ""){ if(typeof vote_address != "undefined" && vote_address != ""){
var proposal = $("input[name='votacion']:checked").val(); var proposal = $("input[name='votacion']:checked").val();
let resultado = await votar(input_address, proposal); let resultado = await votar(vote_address, proposal);
console.log("resultado: "); console.log("resultado: ");
console.log(resultado.toString(10)); console.log(resultado.toString(10));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment