Skip to content

Commit 9dfc5b9

Browse files
committed
Add campaign page prototype
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.
1 parent 2ccde96 commit 9dfc5b9

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

campaign/index.html

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>issuehunter</title>
6+
<link rel="stylesheet" type="text/css" href="http://issuehunter.github.io/stylesheets/github-markdown.css">
7+
<link rel="stylesheet" type="text/css" href="http://issuehunter.github.io/stylesheets/style.css" />
8+
<script src="https://rawgit.com/ethereum/web3.js/develop/dist/web3.js"></script>
9+
<script src="/src/contract-abi.js"></script>
10+
<script src="/src/app.js"></script>
11+
<script src="/src/campaign.js"></script>
12+
</head>
13+
<body>
14+
<article class="markdown-body">
15+
<header class="logo">
16+
<h1><span class="blue">issue</span><span class="red">hunter</span></h1>
17+
</header>
18+
19+
<p><a href="/">Back</a></p>
20+
21+
<h3>Campaign</h3>
22+
<p>
23+
Executed: <strong id="executed"></strong></br>
24+
Total amount: <strong id="totalAmount"></strong></br>
25+
Created by: <strong id="createdBy"></strong></br>
26+
Reward period expires at: <strong id="rewardPeriodExpiresAt"></strong></br>
27+
Execute period expires at: <strong id="executePeriodExpiresAt"></strong></br>
28+
Resolved by: <strong id="resolutor"></strong>
29+
</p>
30+
31+
<div>
32+
<label for="account">Account</label>
33+
<input id="account" type="text" placeholder="0x123">
34+
</div>
35+
<div>
36+
<button onclick="campaignFunds()">Campaign funds</button>
37+
</div>
38+
39+
<p>
40+
Amount: <strong id="amount"></strong>
41+
</p>
42+
</article>
43+
</body>
44+
</html>

src/campaign.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
var issueId = decodeURIComponent(window.location.search.substr(1))
2+
3+
issueHunter.campaigns(issueId, function(err, campaign) {
4+
console.log(campaign)
5+
document.querySelector("#executed").innerText = campaign[0]
6+
document.querySelector("#totalAmount").innerText = web3.fromWei(campaign[1])
7+
document.querySelector("#createdBy").innerText = campaign[2]
8+
document.querySelector("#rewardPeriodExpiresAt").innerText = Date(campaign[3])
9+
document.querySelector("#executePeriodExpiresAt").innerText = Date(campaign[4])
10+
document.querySelector("#resolutor").innerText = campaign[5]
11+
})
12+
13+
function campaignFunds() {
14+
var account = document.querySelector("#account").value
15+
issueHunter.campaignFunds.call(issueId, account, function (err, amount) {
16+
document.querySelector("#amount").innerText = web3.fromWei(amount)
17+
})
18+
}

0 commit comments

Comments
 (0)