Skip to content

Commit c461f88

Browse files
vubvub
vub
authored and
vub
committed
Prettified things a bit
1 parent d985254 commit c461f88

File tree

5 files changed

+34
-20
lines changed

5 files changed

+34
-20
lines changed

arbitration/main.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<head><script src="scripts/web3.min.js"></script><script src="scripts/angular.min.js"></script><script src="scripts/underscore-min.js"></script><script src="scripts/sha3.min.js"></script><script src="scripts/filtered_list.js"></script><script src="config.js"></script><script src="scripts/main.js"></script><script src="scripts/tx_in_progress.js"></script><script src="scripts/dialogMessage.js"></script><link rel="stylesheet" type="text/css" href="styles/main.css"/><link rel="stylesheet" type="text/css" href="styles/bootstrap.min.css"/></head><body ng-app="arbitration"><div ng-controller="ArbitrationCtrl"><div><div style="width:20%; height:100%; position: absolute; left: 0px; top: 0px" class="lightblue"><div style="padding-top: 65px"></div><div ng-click="activetab = 0" ng-class="{ semilightblue: !activetab}" class="tabselect">Make a new escrow</div><div ng-click="activetab = 1" ng-class="{ semilightblue: activetab == 1}" class="tabselect">Register on arbiter list</div><div ng-click="activetab = 2" ng-class="{ semilightblue: activetab == 2}" class="tabselect">Adjudicate disputes</div></div><div style="width:80%; position: absolute; right: 0px"><div style="height: 100%" vertical-align:="vertical-align:" top="top" class="white"><div ng-show="!activetab"><center><table style="margin:100px 0px" cellpadding="20px"><tr><td>Your address</td><td><select ng-model="myAccount" ng-options="x for x in accounts"></select></td></tr><tr><td>Counterparty's address</td><td><input type="text" placeholder="Address" ng-model="escrow.otherAddress"/></td></tr><tr><td>Arbiters</td><td><div ng-repeat="a in escrow.arbiters"><span>{{ a }}</span><button ng-click="removeArbiter(a)" style="margin-left:12px" class="btn raise5">Remove</button></div></td></tr><tr><td>Add new arbiter</td><td><span><input type="text" placeholder="Address" ng-model="escrow.newArbiter"/><button ng-click="addArbiter()" style="margin-left:10px" class="btn raise5">Add</button></span></td></tr><tr><td>Add new arbiter from selection</td><td><select ng-model="escrow.newArbiterFromSelection" ng-options="x for x in arbiters"></select><button ng-click="addArbiterFromSelection()" style="margin-left:12px" class="btn raise5">Add</button></td></tr><tr><td></td><td><span>{{ escrow.newArbiterFromSelectionDescription }}</span></td></tr><tr><td>Description</td><td><input type="text" placeholder="Description" ng-model="escrow.description"/></td></tr><tr><td>Value</td><td><input type="text" placeholder="Value" ng-model="escrow.value"/></td></tr><tr><td>Fee</td><td><input type="text" placeholder="Fee" ng-model="escrow.fee"/></td></tr><tr><td></td><td><button ng-click="createEscrow()" ng-disabled="cannot_create_escrow" class="btn raise5">Create escrow </button><span style="margin-left: 20px" ng-show="cannot_create_escrow" class="redtext">{{ cannot_create_escrow_error_message }}</span></td></tr></table></center></div><div ng-show="activetab == 1"><center><table style="margin:100px 0px" cellpadding="20px"><tr><td>Fee</td><td><input type="text" placeholder="Fee" ng-model="listingFee"/><span>(The more you pay, the higher you will be listed in the dropdown!)</span></td></tr><tr><td> </td><td><button ng-click="registerArbiter()" ng-disabled="cannot_register" class="btn raise5">Register or pay fee</button><span style="margin-left: 20px" ng-show="cannot_register" class="redtext">{{ cannot_register_error_message }}</span></td></tr><tr><td>Current description</td><td><span>{{ currentArbiterDescription }}</span></td></tr><tr><td>New description</td><td><input type="text" placeholder="Description" ng-model="listingDescription"/></td></tr><tr><td> </td><td><button ng-click="setArbiterDescription()" ng-disabled="cannot_set_description" class="btn raise5">Set description</button><span style="margin-left: 20px" ng-show="cannot_set_description" class="redtext">{{ cannot_set_description_error_message }}</span></td></tr></table></center></div><div ng-show="activetab == 2"><center><table style="margin:100px 0px" cellpadding="20px"><tr><td>Description</td><td>Value</td><td>Fee</td><td></td></tr><tr ng-repeat="d in escrows"><td>{{ d.description }}</td><td>{{ d.value }}</td><td>{{ d.fee }}</td><td ng-show="d.type == 1"><button ng-click="vote(d.id, true)" class="btn raise5">Vote A</button><button ng-click="vote(d.id, false)" class="btn raise5">Vote B</button></td><td ng-show="d.type == 2"><button ng-click="vote(d.id, false)" class="btn raise5">Release funds to counterparty</button></td><td ng-show="d.type == 3"><button ng-click="vote(d.id, true)" class="btn raise5">Release funds to counterparty</button></td></tr></table></center></div></div></div><div tx-in-progress="tx-in-progress"></div><div message="message"></div></div></div></body>
1+
<head><script src="scripts/web3.min.js"></script><script src="scripts/angular.min.js"></script><script src="scripts/underscore-min.js"></script><script src="scripts/sha3.min.js"></script><script src="scripts/filtered_list.js"></script><script src="config.js"></script><script src="scripts/main.js"></script><script src="scripts/tx_in_progress.js"></script><script src="scripts/dialogMessage.js"></script><link rel="stylesheet" type="text/css" href="styles/main.css"/><link rel="stylesheet" type="text/css" href="styles/bootstrap.min.css"/></head><body ng-app="arbitration"><div ng-controller="ArbitrationCtrl"><div><div style="width:20%; height:100%; position: absolute; left: 0px; top: 0px" class="lightblue"><div style="padding-top: 65px"></div><div ng-click="activetab = 0" ng-class="{ semilightblue: !activetab}" class="tabselect">Make a new escrow</div><div ng-click="activetab = 1" ng-class="{ semilightblue: activetab == 1}" class="tabselect">Register on arbiter list</div><div ng-click="activetab = 2" ng-class="{ semilightblue: activetab == 2}" class="tabselect">Adjudicate disputes</div></div><div style="width:80%; position: absolute; right: 0px"><div style="height: 100%" vertical-align:="vertical-align:" top="top" class="white"><div ng-show="!activetab"><center><table style="margin:100px 0px" cellpadding="20px"><tr><td>Your address</td><td><select ng-model="myAccount" ng-options="x for x in accounts"></select></td></tr><tr><td>Counterparty's address</td><td><input type="text" placeholder="Address" ng-model="escrow.otherAddress"/></td></tr><tr><td>Arbiters</td><td><div ng-repeat="a in escrow.arbiters" style="height:40px"><small>{{ a }}</small></div></td><td><div ng-repeat="a in escrow.arbiters" style="height:40px"><button ng-click="removeArbiter(a)" style="margin-left:12px" class="btn raise5">Remove</button></div></td></tr><tr><td>Add new arbiter</td><td><span><input type="text" placeholder="Address" ng-model="escrow.newArbiter"/></span></td><td><button ng-click="addArbiter()" style="margin-left:10px" class="btn raise5">Add</button></td></tr><tr><td>Add new arbiter from selection</td><td><select ng-model="escrow.newArbiterFromSelection" ng-options="x for x in arbiters"></select></td><td><button ng-click="addArbiterFromSelection()" style="margin-left:12px" class="btn raise5">Add</button></td></tr><tr><td></td><td><span>{{ escrow.newArbiterFromSelectionDescription }}</span></td></tr><tr><td>Description</td><td><textarea placeholder="Description" ng-model="escrow.description" style="width:333px" rows="4"></textarea></td></tr><tr><td>Value</td><td><input type="text" placeholder="Value" ng-model="escrow.value"/></td></tr><tr><td>Fee</td><td><input type="text" placeholder="Fee" ng-model="escrow.fee"/></td></tr><tr><td></td><td><button ng-click="createEscrow()" ng-disabled="cannot_create_escrow" class="btn raise5">Create escrow </button><small style="margin-left: 20px" ng-show="cannot_create_escrow" class="redtext">{{ cannot_create_escrow_error_message }}</small></td></tr></table></center></div><div ng-show="activetab == 1"><center><table style="margin:100px 0px" cellpadding="20px"><tr><td>Fee</td><td><input type="text" placeholder="Fee" ng-model="listingFee"/></td></tr><tr><td> </td><td><button ng-click="registerArbiter()" ng-disabled="cannot_register" class="btn raise5">Register or pay fee</button><span style="margin-left: 20px" ng-show="cannot_register" class="redtext">{{ cannot_register_error_message }}</span></td></tr><tr><td>Current description</td><td><span>{{ currentArbiterDescription }}</span></td></tr><tr><td>New description</td><td><input type="text" placeholder="Description" ng-model="listingDescription"/></td></tr><tr><td> </td><td><button ng-click="setArbiterDescription()" ng-disabled="cannot_set_description" class="btn raise5">Set description</button><span style="margin-left: 20px" ng-show="cannot_set_description" class="redtext">{{ cannot_set_description_error_message }}</span></td></tr></table></center></div><div ng-show="activetab == 2"><center><table style="margin:100px 0px" cellpadding="20px"><tr><td style="width: 250px">Description</td><td>Value</td><td>Fee</td><td></td><td></td></tr><tr ng-repeat="d in escrows"><td>{{ d.description }}</td><td>{{ d.value }}</td><td>{{ d.fee }}</td><td ng-show="d.type == 1"><button ng-click="vote(d.id, true)" style="width: 45%" class="btn raise5">Vote A</button><button ng-click="vote(d.id, false)" style="width: 45%; margin-left: 8%" class="btn raise5">Vote B</button></td><td ng-show="d.type == 2"><button ng-click="vote(d.id, false)" class="btn raise5">Release funds to counterparty</button></td><td ng-show="d.type == 3"><button ng-click="vote(d.id, true)" class="btn raise5">Release funds to counterparty</button></td></tr></table></center></div></div></div><div tx-in-progress="tx-in-progress"></div><div message="message"></div></div></div></body>

arbitration/main.jade

+13-9
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,23 @@ body(ng-app="arbitration"): div(ng-controller="ArbitrationCtrl")
3333
tr
3434
td Arbiters
3535
td
36-
div(ng-repeat="a in escrow.arbiters")
37-
span {{ a }}
36+
div(ng-repeat="a in escrow.arbiters", style="height:40px")
37+
small {{ a }}
38+
td
39+
div(ng-repeat="a in escrow.arbiters", style="height:40px")
3840
button.btn.raise5(ng-click="removeArbiter(a)", style="margin-left:12px") Remove
3941
tr
4042
td Add new arbiter
4143
td
4244
span
4345
input(type="text",placeholder="Address",ng-model="escrow.newArbiter")
44-
button.btn.raise5(ng-click="addArbiter()", style="margin-left:10px") Add
46+
td
47+
button.btn.raise5(ng-click="addArbiter()", style="margin-left:10px") Add
4548
tr
4649
td Add new arbiter from selection
4750
td
4851
select(ng-model="escrow.newArbiterFromSelection", ng-options="x for x in arbiters")
52+
td
4953
button.btn.raise5(ng-click="addArbiterFromSelection()", style="margin-left:12px") Add
5054
tr
5155
td
@@ -54,7 +58,7 @@ body(ng-app="arbitration"): div(ng-controller="ArbitrationCtrl")
5458
tr
5559
td Description
5660
td
57-
input(type="text",placeholder="Description",ng-model="escrow.description")
61+
textarea(placeholder="Description",ng-model="escrow.description",style="width:333px",rows="4")
5862
tr
5963
td Value
6064
td
@@ -67,15 +71,14 @@ body(ng-app="arbitration"): div(ng-controller="ArbitrationCtrl")
6771
td
6872
td
6973
button.btn.raise5(ng-click="createEscrow()", ng-disabled="cannot_create_escrow") Create escrow
70-
span.redtext(style="margin-left: 20px", ng-show="cannot_create_escrow") {{ cannot_create_escrow_error_message }}
74+
small.redtext(style="margin-left: 20px", ng-show="cannot_create_escrow") {{ cannot_create_escrow_error_message }}
7175
div(ng-show="activetab == 1")
7276
center
7377
table(style="margin:100px 0px",cellpadding="20px")
7478
tr
7579
td Fee
7680
td
7781
input(type="text",placeholder="Fee",ng-model="listingFee")
78-
span (The more you pay, the higher you will be listed in the dropdown!)
7982
tr
8083
td
8184
td
@@ -100,17 +103,18 @@ body(ng-app="arbitration"): div(ng-controller="ArbitrationCtrl")
100103
center
101104
table(style="margin:100px 0px",cellpadding="20px")
102105
tr
103-
td Description
106+
td(style="width: 250px") Description
104107
td Value
105108
td Fee
106109
td
110+
td
107111
tr(ng-repeat="d in escrows")
108112
td {{ d.description }}
109113
td {{ d.value }}
110114
td {{ d.fee }}
111115
td(ng-show="d.type == 1")
112-
button.btn.raise5(ng-click="vote(d.id, true)") Vote A
113-
button.btn.raise5(ng-click="vote(d.id, false)") Vote B
116+
button.btn.raise5(ng-click="vote(d.id, true)", style="width: 45%") Vote A
117+
button.btn.raise5(ng-click="vote(d.id, false)", style="width: 45%; margin-left: 8%") Vote B
114118
td(ng-show="d.type == 2")
115119
button.btn.raise5(ng-click="vote(d.id, false)") Release funds to counterparty
116120
td(ng-show="d.type == 3")

arbitration/scripts/filtered_list.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SAFE_CONFIRMATIONS = 12;
33

44
// Maintain a list of all logs that satisfy a particular filter. Call a
55
// callback when an initial list is prepared.
6-
function filtered_list(filter, cb, cb2) {
6+
function filtered_list(filter, cb) {
77
this.filter = filter;
88
this.logs = [];
99
this.logMap = {};
@@ -28,6 +28,7 @@ function filtered_list(filter, cb, cb2) {
2828
});
2929
web3.eth.filter('latest', function(err, block) { me.filterGrabber(err, block); })
3030
this.filterGrabber = function(err, block) {
31+
console.log('grabbing latest logs for filter')
3132
// Grab all the results within the last SAFE_CONFIRMATIONS confirmations,
3233
// check that they are still valid, and re-sort them just in case as
3334
// filter.watch does sometimes give results out of order
@@ -41,8 +42,7 @@ function filtered_list(filter, cb, cb2) {
4142
}
4243
grab = grab.sort(function(a, b) { return a.blockNumber > b.blockNumber });
4344
grab.map(function(x) { me.logs.append(x) });
44-
console.log('l', me.logs, cb2);
45-
if (cb2) cb2();
45+
console.log('grabbed logs: ', me.logs);
4646
};
4747
this.shutdown = function() { me.filterGrabber = function(){}; };
4848
}

arbitration/scripts/main.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ function ArbitrationCtrl($scope, $rootScope, $http) {
9898
$scope.get_arbiters();
9999
$scope.update_fees_paid_map();
100100
web3.eth.filter('latest').watch(function(err, res) {
101+
console.log('getting arbiters from directory');
101102
$scope.get_arbiters();
102103
$scope.update_fees_paid_map();
104+
console.log('gotten arbiters from directory');
103105
});
104106
// Helper functions to add and remove arbiters
105107
$scope.removeArbiter = function(a) {
@@ -277,7 +279,7 @@ function ArbitrationCtrl($scope, $rootScope, $http) {
277279
});
278280
}
279281
$scope.totGathered += 1;
280-
console.log(93, $scope.totGathered, $scope.numGathering, $scope.gathering.length);
282+
if ($scope.totGathered == $scope.numGathering) {
281283
$scope.escrows = $scope.gathering;
282284
console.log('created escrow list', $scope.escrows);
283285
}
@@ -293,16 +295,22 @@ function ArbitrationCtrl($scope, $rootScope, $http) {
293295
$scope.myOldAccount = $scope.myAccount;
294296
console.log('resetting escrow filters');
295297
[$scope.arbNL1, $scope.arbNL2, $scope.arbNL3].map(function(x) { if (x) x.shutdown() });
296-
var arbNotifyFilter = $scope.arbitration_contract.ArbiterNotification({address: $scope.myAccount}, {fromBlock: eth.blockNumber - 30000});
298+
var gathered = 0;
299+
var cb = function() {
300+
gathered += 1;
301+
if (gathered == 3) { console.log('pl'); $scope.processEscrowList(); }
302+
}
303+
var arbNotifyFilter = $scope.arbitration_contract.ArbiterNotification({address:$scope.myAccount},{fromBlock: eth.blockNumber - 30000});
304+
$scope.arbNL1 = new filtered_list(arbNotifyFilter, cb);
297305
var arbNotifyFilter2 = $scope.arbitration_contract.NewContract({recipientA: $scope.myAccount}, {fromBlock: eth.blockNumber - 30000});
298-
$scope.arbNL2 = new filtered_list(arbNotifyFilter2);
306+
$scope.arbNL2 = new filtered_list(arbNotifyFilter2, cb);
299307
var arbNotifyFilter3 = $scope.arbitration_contract.NewContract({recipientB: $scope.myAccount}, {fromBlock: eth.blockNumber - 30000});
300-
$scope.arbNL3 = new filtered_list(arbNotifyFilter3);
301-
$scope.arbNL1 = new filtered_list(arbNotifyFilter, $scope.processEscrowList);
308+
$scope.arbNL3 = new filtered_list(arbNotifyFilter3, cb);
302309
$scope.myAccount = newVal;
303310
}
311+
eth.filter('latest', $scope.processEscrowList);
304312
setInterval($scope.resetEscrowFilters, 250);
305-
// Make a new escrow
313+
// Vote on a particular escrow
306314
$scope.vote = function(id, value) {
307315
$scope.tryToSend(function() {
308316
return $scope.arbitration_contract.vote(id, value,

arbitration/scripts/tx_in_progress.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ app.directive('txInProgress', function() {
7373
'<table cellpadding="10px">' +
7474
'<tr>' +
7575
'<td>Transaction hash:</td>' +
76-
'<td><a href="http://etherscan.io/tx/{{ txInProgress.txhash }}"> {{ txInProgress.txhash }}</a></td>' +
76+
'<td><small>' +
77+
'<a href="http://etherscan.io/tx/{{ txInProgress.txhash }}"> {{ txInProgress.txhash }}</a>' +
78+
'</small></td>' +
7779
'</tr>' +
7880
'<tr><td>Status:</td><td>{{ txInProgress.status }}</td></tr>' +
7981
'<tr><td>Confirmations:</td><td>{{ txInProgress.confirmations }}</td></tr>' +

0 commit comments

Comments
 (0)