Skip to content

Commit

Permalink
Add campaign page prototype
Browse files Browse the repository at this point in the history
It shows basic campaign info and it exposes a form to call the
`campaignFunds` getter to get the amount funded by an address.

See #3.
  • Loading branch information
potomak committed Sep 14, 2017
1 parent 2ccde96 commit 9dfc5b9
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
44 changes: 44 additions & 0 deletions campaign/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>issuehunter</title>
<link rel="stylesheet" type="text/css" href="http://issuehunter.github.io/stylesheets/github-markdown.css">
<link rel="stylesheet" type="text/css" href="http://issuehunter.github.io/stylesheets/style.css" />
<script src="https://rawgit.com/ethereum/web3.js/develop/dist/web3.js"></script>
<script src="/src/contract-abi.js"></script>
<script src="/src/app.js"></script>
<script src="/src/campaign.js"></script>
</head>
<body>
<article class="markdown-body">
<header class="logo">
<h1><span class="blue">issue</span><span class="red">hunter</span></h1>
</header>

<p><a href="/">Back</a></p>

<h3>Campaign</h3>
<p>
Executed: <strong id="executed"></strong></br>
Total amount: <strong id="totalAmount"></strong></br>
Created by: <strong id="createdBy"></strong></br>
Reward period expires at: <strong id="rewardPeriodExpiresAt"></strong></br>
Execute period expires at: <strong id="executePeriodExpiresAt"></strong></br>
Resolved by: <strong id="resolutor"></strong>
</p>

<div>
<label for="account">Account</label>
<input id="account" type="text" placeholder="0x123">
</div>
<div>
<button onclick="campaignFunds()">Campaign funds</button>
</div>

<p>
Amount: <strong id="amount"></strong>
</p>
</article>
</body>
</html>
18 changes: 18 additions & 0 deletions src/campaign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var issueId = decodeURIComponent(window.location.search.substr(1))

issueHunter.campaigns(issueId, function(err, campaign) {
console.log(campaign)
document.querySelector("#executed").innerText = campaign[0]
document.querySelector("#totalAmount").innerText = web3.fromWei(campaign[1])
document.querySelector("#createdBy").innerText = campaign[2]
document.querySelector("#rewardPeriodExpiresAt").innerText = Date(campaign[3])
document.querySelector("#executePeriodExpiresAt").innerText = Date(campaign[4])
document.querySelector("#resolutor").innerText = campaign[5]
})

function campaignFunds() {
var account = document.querySelector("#account").value
issueHunter.campaignFunds.call(issueId, account, function (err, amount) {
document.querySelector("#amount").innerText = web3.fromWei(amount)
})
}

0 comments on commit 9dfc5b9

Please sign in to comment.