Personal data are moved to 2nd screen. This closes #2
This commit is contained in:
parent
d6ceeffff5
commit
b82d70468e
|
@ -21,7 +21,9 @@ Here you can vote for or against notary. If total number of votes > 3, notary wi
|
|||
## New ballot page
|
||||
Click **NEW BALLOT** button from any page to create a new ballot.
|
||||
|
||||
![](./new_ballot.png)
|
||||
![](./new_ballot_1.png)
|
||||
|
||||
![](./new_ballot_2.png)
|
||||
|
||||
## Configuration file
|
||||
It is configured with [Oracles network contract](https://github.com/oraclesorg/oracles-contract)
|
||||
|
|
|
@ -963,8 +963,15 @@ $(function() {
|
|||
|
||||
//back button onclick event
|
||||
$(".back").on("click", function() {
|
||||
ballotsNavPan();
|
||||
getBallotsArray();
|
||||
if ($(".new-ballot-add").attr("step") == 2) {
|
||||
$(".new-ballot-inputs").removeClass("hidden");
|
||||
$(".personal-data-inputs").addClass("hidden");
|
||||
$(".new-ballot-add").attr("step", 1);
|
||||
$(".new-ballot-add").html("Continue");
|
||||
} else {
|
||||
ballotsNavPan();
|
||||
getBallotsArray();
|
||||
}
|
||||
});
|
||||
|
||||
//settings button onclick event
|
||||
|
@ -982,8 +989,29 @@ $(function() {
|
|||
$(".container.new-ballot").empty();
|
||||
$(".container.new-ballot").load("./newBallot.html", function() {
|
||||
newBallotNavPan();
|
||||
|
||||
|
||||
$("#type_add").click(function() {
|
||||
$(".new-ballot-add").attr("step", 1);
|
||||
$(".new-ballot-add").html("Continue");
|
||||
});
|
||||
|
||||
$("#type_remove").click(function() {
|
||||
$(".new-ballot-add").attr("step", 2);
|
||||
$(".new-ballot-add").html("Add Ballot");
|
||||
});
|
||||
|
||||
$(".new-ballot-add").on("click", function() {
|
||||
if ($(this).attr("step") == 1) {
|
||||
$(".new-ballot-inputs").addClass("hidden");
|
||||
$(".personal-data-inputs").removeClass("hidden");
|
||||
$(".new-ballot-add").attr("step", 2);
|
||||
$(".new-ballot-add").html("Add Ballot");
|
||||
return;
|
||||
}
|
||||
|
||||
$(".loading-container").show();
|
||||
var addAction = $("input[name=type]:checked").val();
|
||||
var ballotViewObj = {
|
||||
ballotID: generateBallotID(),
|
||||
memo: $("#memo").val(),
|
||||
|
@ -991,17 +1019,9 @@ $(function() {
|
|||
affectedKey: $("#affected-key").val(),
|
||||
affectedKeyType: parseInt($("#affected-key-type").val()),
|
||||
owner: votingKey,
|
||||
addAction: $("input[name=type]:checked").val()
|
||||
};
|
||||
var validatorViewObj = {
|
||||
miningKey: $("#mining-key").val(),
|
||||
fullName: $("#full-name").val(),
|
||||
streetName: $("#address").val(),
|
||||
state: $("#state").val(),
|
||||
zip: $("#zip").val(),
|
||||
licenseID: $("#license-id").val(),
|
||||
licenseExpiredAt: new Date($("#license-expiration").val()).getTime() / 1000,
|
||||
addAction: addAction
|
||||
};
|
||||
|
||||
var isAddress1 = web3.isAddress($("#mining-key").val());
|
||||
var isAddress2 = web3.isAddress($("#affected-key").val());
|
||||
if (!isAddress1 || !isAddress2) {
|
||||
|
@ -1010,48 +1030,66 @@ $(function() {
|
|||
return;
|
||||
}
|
||||
|
||||
addBallot(api,
|
||||
"addBallot(uint256,address,address,address,uint256,bool,string)",
|
||||
ballotViewObj,
|
||||
votingKey,
|
||||
config.Ethereum[config.environment].contractAddress,
|
||||
function(txHash, err) {
|
||||
if (err) {
|
||||
$(".loading-container").hide();
|
||||
showAlert(err, err.message);
|
||||
return;
|
||||
}
|
||||
if (!addAction) {
|
||||
newBallotClickCallback(ballotViewObj);
|
||||
} else {
|
||||
var validatorViewObj = {
|
||||
miningKey: $("#mining-key").val(),
|
||||
fullName: $("#full-name").val(),
|
||||
streetName: $("#address").val(),
|
||||
state: $("#state").val(),
|
||||
zip: $("#zip").val(),
|
||||
licenseID: $("#license-id").val(),
|
||||
licenseExpiredAt: new Date($("#license-expiration").val()).getTime() / 1000,
|
||||
};
|
||||
|
||||
newBallotClickCallback(ballotViewObj);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function newBallotClickCallback(ballotViewObj) {
|
||||
addBallot(api,
|
||||
"addBallot(uint256,address,address,address,uint256,bool,string)",
|
||||
ballotViewObj,
|
||||
votingKey,
|
||||
config.Ethereum[config.environment].contractAddress,
|
||||
function(txHash, err) {
|
||||
if (err) {
|
||||
$(".loading-container").hide();
|
||||
showAlert(err, err.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ballotViewObj.addAction) {
|
||||
getTxCallBack(txHash, function() {
|
||||
$(".loading-container").hide();
|
||||
$(".back").trigger("click");
|
||||
});
|
||||
} else {
|
||||
addValidator(api,
|
||||
"addValidator(address,uint256,uint256,uint256,string,string,string)",
|
||||
validatorViewObj,
|
||||
votingKey,
|
||||
config.Ethereum[config.environment].contractAddress,
|
||||
function(txHash, err) {
|
||||
if (err) {
|
||||
$(".loading-container").hide();
|
||||
showAlert(err, err.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ballotViewObj.addAction) {
|
||||
getTxCallBack(txHash, function() {
|
||||
$(".loading-container").hide();
|
||||
$(".back").trigger("click");
|
||||
});
|
||||
} else {
|
||||
addValidator(api,
|
||||
"addValidator(address,uint256,uint256,uint256,string,string,string)",
|
||||
validatorViewObj,
|
||||
votingKey,
|
||||
config.Ethereum[config.environment].contractAddress,
|
||||
function(txHash, err) {
|
||||
if (err) {
|
||||
$(".loading-container").hide();
|
||||
showAlert(err, err.message);
|
||||
return;
|
||||
}
|
||||
|
||||
getTxCallBack(txHash, function() {
|
||||
$(".loading-container").hide();
|
||||
$(".back").trigger("click");
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getBallotsCallBack(_ballotsArray) {
|
||||
for(var i = 0; i < _ballotsArray.length; i++) {
|
||||
|
|
|
@ -79,8 +79,15 @@ $(function() {
|
|||
|
||||
//back button onclick event
|
||||
$(".back").on("click", function() {
|
||||
ballotsNavPan();
|
||||
getBallotsArray();
|
||||
if ($(".new-ballot-add").attr("step") == 2) {
|
||||
$(".new-ballot-inputs").removeClass("hidden");
|
||||
$(".personal-data-inputs").addClass("hidden");
|
||||
$(".new-ballot-add").attr("step", 1);
|
||||
$(".new-ballot-add").html("Continue");
|
||||
} else {
|
||||
ballotsNavPan();
|
||||
getBallotsArray();
|
||||
}
|
||||
});
|
||||
|
||||
//settings button onclick event
|
||||
|
@ -98,8 +105,29 @@ $(function() {
|
|||
$(".container.new-ballot").empty();
|
||||
$(".container.new-ballot").load("./newBallot.html", function() {
|
||||
newBallotNavPan();
|
||||
|
||||
|
||||
$("#type_add").click(function() {
|
||||
$(".new-ballot-add").attr("step", 1);
|
||||
$(".new-ballot-add").html("Continue");
|
||||
});
|
||||
|
||||
$("#type_remove").click(function() {
|
||||
$(".new-ballot-add").attr("step", 2);
|
||||
$(".new-ballot-add").html("Add Ballot");
|
||||
});
|
||||
|
||||
$(".new-ballot-add").on("click", function() {
|
||||
if ($(this).attr("step") == 1) {
|
||||
$(".new-ballot-inputs").addClass("hidden");
|
||||
$(".personal-data-inputs").removeClass("hidden");
|
||||
$(".new-ballot-add").attr("step", 2);
|
||||
$(".new-ballot-add").html("Add Ballot");
|
||||
return;
|
||||
}
|
||||
|
||||
$(".loading-container").show();
|
||||
var addAction = $("input[name=type]:checked").val();
|
||||
var ballotViewObj = {
|
||||
ballotID: generateBallotID(),
|
||||
memo: $("#memo").val(),
|
||||
|
@ -107,17 +135,9 @@ $(function() {
|
|||
affectedKey: $("#affected-key").val(),
|
||||
affectedKeyType: parseInt($("#affected-key-type").val()),
|
||||
owner: votingKey,
|
||||
addAction: $("input[name=type]:checked").val()
|
||||
};
|
||||
var validatorViewObj = {
|
||||
miningKey: $("#mining-key").val(),
|
||||
fullName: $("#full-name").val(),
|
||||
streetName: $("#address").val(),
|
||||
state: $("#state").val(),
|
||||
zip: $("#zip").val(),
|
||||
licenseID: $("#license-id").val(),
|
||||
licenseExpiredAt: new Date($("#license-expiration").val()).getTime() / 1000,
|
||||
addAction: addAction
|
||||
};
|
||||
|
||||
var isAddress1 = web3.isAddress($("#mining-key").val());
|
||||
var isAddress2 = web3.isAddress($("#affected-key").val());
|
||||
if (!isAddress1 || !isAddress2) {
|
||||
|
@ -126,48 +146,66 @@ $(function() {
|
|||
return;
|
||||
}
|
||||
|
||||
addBallot(api,
|
||||
"addBallot(uint256,address,address,address,uint256,bool,string)",
|
||||
ballotViewObj,
|
||||
votingKey,
|
||||
config.Ethereum[config.environment].contractAddress,
|
||||
function(txHash, err) {
|
||||
if (err) {
|
||||
$(".loading-container").hide();
|
||||
showAlert(err, err.message);
|
||||
return;
|
||||
}
|
||||
if (!addAction) {
|
||||
newBallotClickCallback(ballotViewObj);
|
||||
} else {
|
||||
var validatorViewObj = {
|
||||
miningKey: $("#mining-key").val(),
|
||||
fullName: $("#full-name").val(),
|
||||
streetName: $("#address").val(),
|
||||
state: $("#state").val(),
|
||||
zip: $("#zip").val(),
|
||||
licenseID: $("#license-id").val(),
|
||||
licenseExpiredAt: new Date($("#license-expiration").val()).getTime() / 1000,
|
||||
};
|
||||
|
||||
newBallotClickCallback(ballotViewObj);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function newBallotClickCallback(ballotViewObj) {
|
||||
addBallot(api,
|
||||
"addBallot(uint256,address,address,address,uint256,bool,string)",
|
||||
ballotViewObj,
|
||||
votingKey,
|
||||
config.Ethereum[config.environment].contractAddress,
|
||||
function(txHash, err) {
|
||||
if (err) {
|
||||
$(".loading-container").hide();
|
||||
showAlert(err, err.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ballotViewObj.addAction) {
|
||||
getTxCallBack(txHash, function() {
|
||||
$(".loading-container").hide();
|
||||
$(".back").trigger("click");
|
||||
});
|
||||
} else {
|
||||
addValidator(api,
|
||||
"addValidator(address,uint256,uint256,uint256,string,string,string)",
|
||||
validatorViewObj,
|
||||
votingKey,
|
||||
config.Ethereum[config.environment].contractAddress,
|
||||
function(txHash, err) {
|
||||
if (err) {
|
||||
$(".loading-container").hide();
|
||||
showAlert(err, err.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ballotViewObj.addAction) {
|
||||
getTxCallBack(txHash, function() {
|
||||
$(".loading-container").hide();
|
||||
$(".back").trigger("click");
|
||||
});
|
||||
} else {
|
||||
addValidator(api,
|
||||
"addValidator(address,uint256,uint256,uint256,string,string,string)",
|
||||
validatorViewObj,
|
||||
votingKey,
|
||||
config.Ethereum[config.environment].contractAddress,
|
||||
function(txHash, err) {
|
||||
if (err) {
|
||||
$(".loading-container").hide();
|
||||
showAlert(err, err.message);
|
||||
return;
|
||||
}
|
||||
|
||||
getTxCallBack(txHash, function() {
|
||||
$(".loading-container").hide();
|
||||
$(".back").trigger("click");
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getBallotsCallBack(_ballotsArray) {
|
||||
for(var i = 0; i < _ballotsArray.length; i++) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -61,7 +61,6 @@ select {
|
|||
select {
|
||||
padding: 0 15px;
|
||||
height: 36px;
|
||||
width: 380px;
|
||||
font-size: 11px;
|
||||
background: #fff;
|
||||
}
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<form action="">
|
||||
<div class="new-ballot-inputs">
|
||||
<div class="left">
|
||||
<label for="full-name">Full name</label>
|
||||
<input type="text" id="full-name">
|
||||
<label for="address">Address</label>
|
||||
<input type="text" id="address">
|
||||
<label for="state">State</label>
|
||||
<input type="text" id="state">
|
||||
<label for="zip">Zip code</label>
|
||||
<input type="number" id="zip">
|
||||
<label for="license-id">License id</label>
|
||||
<input type="number" id="license-id">
|
||||
<label for="license-expiration">License expiration</label>
|
||||
<input type="date" id="license-expiration">
|
||||
</div>
|
||||
<div class="right">
|
||||
<label for="memo">Memo</label>
|
||||
<textarea id="memo"></textarea>
|
||||
<div class="new-ballot-description">
|
||||
Please type your memo, for example, add or remove mining key, full name,
|
||||
and a reason.
|
||||
</div>
|
||||
<label for="key">Mining key</label>
|
||||
<input type="text" id="mining-key">
|
||||
<label for="affected-key-type">Affected key type</label>
|
||||
|
@ -31,11 +11,37 @@
|
|||
</select>
|
||||
<label for="affected-key">Affected key</label>
|
||||
<input type="text" id="affected-key">
|
||||
</div>
|
||||
<div class="right">
|
||||
<label for="memo">Memo</label>
|
||||
<textarea id="memo"></textarea>
|
||||
<div class="new-ballot-description">
|
||||
Please type your memo, for example, add or remove mining key, full name,
|
||||
and a reason.
|
||||
</div>
|
||||
<input type="radio" name="type" id="type_add" value=1 checked>
|
||||
<label class="radio" for="type_add">Add</label>
|
||||
<input type="radio" name="type" id="type_remove" value=0>
|
||||
<label class="radio" for="type_remove">Remove</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="new-ballot-add">Add ballot</button>
|
||||
<div class="personal-data-inputs hidden">
|
||||
<div class="left">
|
||||
<label for="full-name">Full name</label>
|
||||
<input type="text" id="full-name">
|
||||
<label for="address">Address</label>
|
||||
<input type="text" id="address">
|
||||
<label for="state">State</label>
|
||||
<input type="text" id="state">
|
||||
</div>
|
||||
<div class="right">
|
||||
<label for="zip">Zip code</label>
|
||||
<input type="number" id="zip">
|
||||
<label for="license-id">License id</label>
|
||||
<input type="number" id="license-id">
|
||||
<label for="license-expiration">License expiration</label>
|
||||
<input type="date" id="license-expiration">
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="new-ballot-add" step=1>Continue</button>
|
||||
</form>
|
Binary file not shown.
After Width: | Height: | Size: 241 KiB |
Binary file not shown.
After Width: | Height: | Size: 230 KiB |
Loading…
Reference in New Issue