Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b8ded8e6a8 | |||
| 26cebc11c6 | |||
| 2a9f9a50c4 | |||
| 7c98de3e6a | |||
| cd6fbfe17c | |||
| ad76fb2369 | |||
| 0f9664410b | |||
| d05356cfe4 | |||
| 1de2e002bb | |||
| 7a072f2586 | |||
| 3eb58451cc | |||
| 9cc4f85a69 | |||
| 29602d5c36 | |||
| b15191aa0e | |||
| d6d4e51ea3 | |||
| bb3696addc | |||
| 96ea4bb993 | |||
| 433d6b0d59 | |||
| 0235313282 | |||
| 10763b1e7f | |||
| 1f39884eef | |||
| d0e10babfe |
@@ -5,29 +5,64 @@ export default Ember.Component.extend({
|
|||||||
id: null,
|
id: null,
|
||||||
realName: null,
|
realName: null,
|
||||||
address: null,
|
address: null,
|
||||||
|
ipfsHash: null,
|
||||||
|
isCore: true,
|
||||||
|
|
||||||
classId: function() {
|
inProgress: false,
|
||||||
let value = this.get('id');
|
|
||||||
return (Ember.isEmpty(value)) ? null : 'valid';
|
isValidId: function() {
|
||||||
|
return Ember.isPresent(this.get('id'));
|
||||||
}.property('id'),
|
}.property('id'),
|
||||||
|
|
||||||
classRealName: function() {
|
isValidRealName: function() {
|
||||||
let value = this.get('realName');
|
return Ember.isPresent(this.get('realName'));
|
||||||
return (Ember.isEmpty(value)) ? null : 'valid';
|
|
||||||
}.property('realName'),
|
}.property('realName'),
|
||||||
|
|
||||||
classAddress: function() {
|
isValidAddress: function() {
|
||||||
let value = this.get('address');
|
return this.get('kredits.web3Instance').isAddress(this.get('address'));
|
||||||
return (Ember.isEmpty(value)) ? null : 'valid';
|
|
||||||
}.property('address'),
|
}.property('address'),
|
||||||
|
|
||||||
|
isValid: function() {
|
||||||
|
return this.get('isValidId') && this.get('isValidRealName') && this.get('isValidAddress');
|
||||||
|
}.property('isValidAddress', 'isValidId', 'isValidRealName'),
|
||||||
|
|
||||||
|
reset: function() {
|
||||||
|
this.setProperties({
|
||||||
|
id: null,
|
||||||
|
realName: null,
|
||||||
|
address: null,
|
||||||
|
ipfsHash: null,
|
||||||
|
isCore: true,
|
||||||
|
inProgress: false
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
console.log('id', this.get('id'));
|
if (!this.get('contractInteractionEnabled')) {
|
||||||
console.log('realName', this.get('realName'));
|
alert('Only core team members can add new contributors. Please ask someone to set you up.');
|
||||||
console.log('address', this.get('address'));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.get('isValid')) {
|
||||||
|
this.set('inProgress', true);
|
||||||
|
|
||||||
|
this.get('kredits').addContributor(
|
||||||
|
this.get('address'),
|
||||||
|
this.get('realName'),
|
||||||
|
'', // TODO: this.get('ipfsHash')
|
||||||
|
this.get('isCore'),
|
||||||
|
this.get('id')
|
||||||
|
).then(contributor => {
|
||||||
|
this.reset();
|
||||||
|
this.get('contributors').pushObject(contributor);
|
||||||
|
window.scroll(0,0);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
alert('Invalid data. Please review and try again.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,23 +4,23 @@
|
|||||||
type="text"
|
type="text"
|
||||||
placeholder="GitHub UID (123)"
|
placeholder="GitHub UID (123)"
|
||||||
value=id
|
value=id
|
||||||
class=classId}}
|
class=(if isValidId 'valid' '')}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{{input name="realname"
|
{{input name="realname"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Carl Sagan"
|
placeholder="Carl Sagan"
|
||||||
value=realName
|
value=realName
|
||||||
class=classRealName}}
|
class=(if isValidRealName 'valid' '')}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{{input name="address"
|
{{input name="address"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4"
|
placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4"
|
||||||
value=address
|
value=address
|
||||||
class=classAddress}}
|
class=(if isValidAddress 'valid' '')}}
|
||||||
</p>
|
</p>
|
||||||
<p class="actions">
|
<p class="actions">
|
||||||
<input type="submit" value="Save">
|
{{input type="submit" value=(if inProgress 'Processing' 'Save') disabled=inProgress}}
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{{#each contributors as |contributor|}}
|
{{#each contributors as |contributor|}}
|
||||||
<tr>
|
<tr class="{{if contributor.isCurrentUser 'current-user'}}">
|
||||||
<td class="person">
|
<td class="person">
|
||||||
<img class="avatar" src={{contributor.avatarURL}}>
|
<img class="avatar" src={{contributor.avatarURL}}>
|
||||||
{{contributor.github_username}}
|
{{contributor.github_username}}
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ export default Ember.Component.extend({
|
|||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
confirm(proposalId) {
|
confirm(proposalId) {
|
||||||
|
if (this.get('contractInteractionEnabled')) {
|
||||||
this.sendAction('confirmAction', proposalId);
|
this.sendAction('confirmAction', proposalId);
|
||||||
|
} else {
|
||||||
|
window.alert('Only members can vote on proposals. Please ask someone to set you up.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
import Proposal from 'kredits-web/models/proposal';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
computed,
|
computed,
|
||||||
@@ -22,21 +23,21 @@ export default Ember.Controller.extend({
|
|||||||
let proposals = this.get('model.proposals')
|
let proposals = this.get('model.proposals')
|
||||||
.filterBy('executed', false)
|
.filterBy('executed', false)
|
||||||
.map(p => {
|
.map(p => {
|
||||||
p.recipientName = this.findContributorByAddress(p.recipientAddress).github_username;
|
p.set('recipientName', this.findContributorByAddress(p.get('recipientAddress')).github_username);
|
||||||
return p;
|
return p;
|
||||||
});
|
});
|
||||||
return proposals;
|
return proposals;
|
||||||
}.property('model.proposals.[]', 'model.contributors.[]'),
|
}.property('model.proposals.[]', 'model.proposals.@each.executed', 'model.contributors.[]'),
|
||||||
|
|
||||||
proposalsClosed: function() {
|
proposalsClosed: function() {
|
||||||
let proposals = this.get('model.proposals')
|
let proposals = this.get('model.proposals')
|
||||||
.filterBy('executed', true)
|
.filterBy('executed', true)
|
||||||
.map(p => {
|
.map(p => {
|
||||||
p.recipientName = this.findContributorByAddress(p.recipientAddress).github_username;
|
p.set('recipientName', this.findContributorByAddress(p.get('recipientAddress')).github_username);
|
||||||
return p;
|
return p;
|
||||||
});
|
});
|
||||||
return proposals;
|
return proposals;
|
||||||
}.property('model.proposals.[]', 'model.contributors.[]'),
|
}.property('model.proposals.[]', 'model.proposals.@each.executed', 'model.contributors.[]'),
|
||||||
|
|
||||||
proposalsSorting: ['id:desc'],
|
proposalsSorting: ['id:desc'],
|
||||||
proposalsClosedSorted: Ember.computed.sort('proposalsClosed', 'proposalsSorting'),
|
proposalsClosedSorted: Ember.computed.sort('proposalsClosed', 'proposalsSorting'),
|
||||||
@@ -45,6 +46,89 @@ export default Ember.Controller.extend({
|
|||||||
contributorsSorting: ['kredits:desc'],
|
contributorsSorting: ['kredits:desc'],
|
||||||
contributorsSorted: Ember.computed.sort('model.contributors', 'contributorsSorting'),
|
contributorsSorted: Ember.computed.sort('model.contributors', 'contributorsSorting'),
|
||||||
|
|
||||||
|
watchContractEvents: function() {
|
||||||
|
let events = this.get('kredits.kreditsContract')
|
||||||
|
.allEvents(/* [additionalFilterObject], */);
|
||||||
|
|
||||||
|
events.watch((error, data) => {
|
||||||
|
Ember.Logger.debug('[index] Received contract event', data);
|
||||||
|
|
||||||
|
switch (data.event) {
|
||||||
|
case 'ProposalCreated':
|
||||||
|
this._handleProposalCreated(data);
|
||||||
|
break;
|
||||||
|
case 'ProposalExecuted':
|
||||||
|
this._handleProposalExecuted(data);
|
||||||
|
break;
|
||||||
|
case 'ProposalVoted':
|
||||||
|
this._handleProposalVoted(data);
|
||||||
|
break;
|
||||||
|
case 'Transfer':
|
||||||
|
this._handleTransfer(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}.on('init'),
|
||||||
|
|
||||||
|
_handleProposalCreated(data) {
|
||||||
|
if (Ember.isPresent(this.get('model.proposals')
|
||||||
|
.findBy('id', data.args.id.toNumber()))) {
|
||||||
|
Ember.Logger.debug('[index] proposal exists, not adding from event');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let proposal = Proposal.create({
|
||||||
|
id: data.args.id.toNumber(),
|
||||||
|
creatorAddress: data.args.creator,
|
||||||
|
recipientAddress: data.args.recipient,
|
||||||
|
recipientName: null,
|
||||||
|
votesCount: 0,
|
||||||
|
votesNeeded: 2,
|
||||||
|
amount: data.args.amount.toNumber(),
|
||||||
|
executed: false,
|
||||||
|
url: data.args.url,
|
||||||
|
ipfsHash: data.args.ipfsHash
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('model.proposals').pushObject(proposal);
|
||||||
|
},
|
||||||
|
|
||||||
|
_handleProposalExecuted(data) {
|
||||||
|
if (this.get('model.proposals')
|
||||||
|
.findBy('id', data.args.id.toNumber())
|
||||||
|
.get('executed')) {
|
||||||
|
Ember.Logger.debug('[index] proposal already executed, not adding from event');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.get('model.proposals')
|
||||||
|
.findBy('id', data.args.id.toNumber())
|
||||||
|
.setProperties({
|
||||||
|
'executed': true,
|
||||||
|
'votesCount': 2 // TODO use real count
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('model.contributors')
|
||||||
|
.findBy('address', data.args.recipient)
|
||||||
|
.incrementProperty('kredits', data.args.amount.toNumber());
|
||||||
|
},
|
||||||
|
|
||||||
|
_handleProposalVoted(data) {
|
||||||
|
this.get('model.proposals')
|
||||||
|
.findBy('id', data.args.id.toNumber())
|
||||||
|
.incrementProperty('votesCount', 1);
|
||||||
|
},
|
||||||
|
|
||||||
|
_handleTransfer(data) {
|
||||||
|
this.get('model.contributors')
|
||||||
|
.findBy('address', data.args.from)
|
||||||
|
.incrementProperty('kredits', - data.args.value.toNumber());
|
||||||
|
this.get('model.contributors')
|
||||||
|
.findBy('address', data.args.to)
|
||||||
|
.incrementProperty('kredits', data.args.value.toNumber());
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
confirmProposal(proposalId) {
|
confirmProposal(proposalId) {
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<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>KreditsWeb</title>
|
<title>Kredits</title>
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ import Ember from 'ember';
|
|||||||
|
|
||||||
export default Ember.Object.extend({
|
export default Ember.Object.extend({
|
||||||
|
|
||||||
|
address: null,
|
||||||
github_username: null,
|
github_username: null,
|
||||||
github_uid: null,
|
github_uid: null,
|
||||||
|
ipfsHash: null,
|
||||||
kredits: null,
|
kredits: null,
|
||||||
address: null,
|
isCurrentUser: false,
|
||||||
|
|
||||||
avatarURL: function() {
|
avatarURL: function() {
|
||||||
return `https\:\/\/avatars2.githubusercontent.com/u/${this.get('github_uid')}?v=3&s=128`;
|
return `https\:\/\/avatars2.githubusercontent.com/u/${this.get('github_uid')}?v=3&s=128`;
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ import Ember from 'ember';
|
|||||||
export default Ember.Object.extend({
|
export default Ember.Object.extend({
|
||||||
|
|
||||||
id: null,
|
id: null,
|
||||||
creator: null,
|
creatorAddress: null,
|
||||||
recipient: null,
|
recipientAddress: null,
|
||||||
|
recipientName: null,
|
||||||
votesCount: null,
|
votesCount: null,
|
||||||
votesNeeded: null,
|
votesNeeded: null,
|
||||||
amount: null,
|
amount: null,
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import Ember from 'ember';
|
||||||
|
import ipfsAPI from 'npm:ipfs-api';
|
||||||
|
import config from 'kredits-web/config/environment';
|
||||||
|
|
||||||
|
export default Ember.Service.extend({
|
||||||
|
|
||||||
|
ipfsInstance: null,
|
||||||
|
|
||||||
|
ipfs: function() {
|
||||||
|
if (this.get('ipfsInstance')) {
|
||||||
|
return this.get('ipfsInstance');
|
||||||
|
}
|
||||||
|
let ipfs = ipfsAPI(config.ipfs);
|
||||||
|
this.set('ipfsInstance', ipfs);
|
||||||
|
return ipfs;
|
||||||
|
}.property('ipfsInstance'),
|
||||||
|
|
||||||
|
storeFile(content) {
|
||||||
|
let ipfs = this.get('ipfs');
|
||||||
|
return ipfs.add(new ipfs.Buffer(content)).then(res => {
|
||||||
|
return res[0].hash;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
getFile(hash) {
|
||||||
|
return this.get('ipfs').cat(hash, { buffer: true }).then(res => {
|
||||||
|
return res.toString();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
+38
-8
@@ -3,14 +3,17 @@ import Web3 from 'npm:web3';
|
|||||||
import config from 'kredits-web/config/environment';
|
import config from 'kredits-web/config/environment';
|
||||||
import Contributor from 'kredits-web/models/contributor';
|
import Contributor from 'kredits-web/models/contributor';
|
||||||
import Proposal from 'kredits-web/models/proposal';
|
import Proposal from 'kredits-web/models/proposal';
|
||||||
|
import kreditsContracts from 'npm:kredits-contracts';
|
||||||
|
|
||||||
export default Ember.Service.extend({
|
export default Ember.Service.extend({
|
||||||
|
|
||||||
|
ipfs: Ember.inject.service(),
|
||||||
|
|
||||||
web3Instance: null,
|
web3Instance: null,
|
||||||
web3Provided: false, // Web3 provided (using Mist Browser, Metamask et al.)
|
web3Provided: false, // Web3 provided (using Mist Browser, Metamask et al.)
|
||||||
|
|
||||||
web3: function() {
|
web3: function() {
|
||||||
if (Ember.isPresent(this.get('web3Instance'))) {
|
if (this.get('web3Instance')) {
|
||||||
return this.get('web3Instance');
|
return this.get('web3Instance');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +25,7 @@ export default Ember.Service.extend({
|
|||||||
this.set('web3Provided', true);
|
this.set('web3Provided', true);
|
||||||
} else {
|
} else {
|
||||||
Ember.Logger.debug('[kredits] Creating new instance from npm module class');
|
Ember.Logger.debug('[kredits] Creating new instance from npm module class');
|
||||||
let provider = new Web3.providers.HttpProvider("http://139.59.248.169:8545");
|
let provider = new Web3.providers.HttpProvider(config.web3ProviderUrl);
|
||||||
web3Instance = new Web3(provider);
|
web3Instance = new Web3(provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,12 +35,19 @@ export default Ember.Service.extend({
|
|||||||
return web3Instance;
|
return web3Instance;
|
||||||
}.property('web3Instance'),
|
}.property('web3Instance'),
|
||||||
|
|
||||||
|
currentUserAccounts: function() {
|
||||||
|
return (this.get('web3Provided') && this.get('web3').eth.accounts) || [];
|
||||||
|
}.property('web3', 'web3Provided'),
|
||||||
|
|
||||||
kreditsContract: function() {
|
kreditsContract: function() {
|
||||||
// TODO cache this
|
if (this.get('kreditsContractInstance')) {
|
||||||
let contract = this.get('web3')
|
return this.get('kreditsContractInstance');
|
||||||
.eth.contract(config.kreditsContract.ABI)
|
}
|
||||||
.at(config.kreditsContract.address);
|
|
||||||
window.Kredits = contract;
|
console.log(config.ethereumChain);
|
||||||
|
let contract = kreditsContracts(this.get('web3'), config.ethereumChain)['Kredits'];
|
||||||
|
|
||||||
|
this.set('kreditsContractInstance', contract);
|
||||||
return contract;
|
return contract;
|
||||||
}.property('web3'),
|
}.property('web3'),
|
||||||
|
|
||||||
@@ -60,7 +70,8 @@ export default Ember.Service.extend({
|
|||||||
github_username: person[1],
|
github_username: person[1],
|
||||||
github_uid: person[0],
|
github_uid: person[0],
|
||||||
ipfsHash: person[3],
|
ipfsHash: person[3],
|
||||||
kredits: balance.toNumber()
|
kredits: balance.toNumber(),
|
||||||
|
isCurrentUser: this.get('currentUserAccounts').includes(address)
|
||||||
});
|
});
|
||||||
Ember.Logger.debug('[kredits] contributor', contributor);
|
Ember.Logger.debug('[kredits] contributor', contributor);
|
||||||
resolve(contributor);
|
resolve(contributor);
|
||||||
@@ -127,6 +138,25 @@ export default Ember.Service.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addContributor(address, name, ipfsHash, isCore, id) {
|
||||||
|
Ember.Logger.debug('[kredits] add contributor', name, address);
|
||||||
|
return new Ember.RSVP.Promise((resolve, reject) => {
|
||||||
|
this.get('kreditsContract').addContributor(address, name, ipfsHash, isCore, id, (err, data) => {
|
||||||
|
if (err) { reject(err); }
|
||||||
|
Ember.Logger.debug('[kredits] add contributor response', data);
|
||||||
|
let contributor = Contributor.create({
|
||||||
|
address: address,
|
||||||
|
github_username: name,
|
||||||
|
github_uid: id,
|
||||||
|
ipfsHash: ipfsHash,
|
||||||
|
kredits: 0,
|
||||||
|
isCurrentUser: this.get('currentUserAccounts').includes(address)
|
||||||
|
});
|
||||||
|
resolve(contributor);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
logKreditsContract: function() {
|
logKreditsContract: function() {
|
||||||
Ember.Logger.debug('[kredits] kreditsContract', this.get('kreditsContract'));
|
Ember.Logger.debug('[kredits] kreditsContract', this.get('kreditsContract'));
|
||||||
}.on('init')
|
}.on('init')
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ section#add-contributor {
|
|||||||
|
|
||||||
input[type=submit] {
|
input[type=submit] {
|
||||||
padding: 0.6rem 2rem;
|
padding: 0.6rem 2rem;
|
||||||
|
&:disabled {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ table.contributor-list {
|
|||||||
&:first-of-type {
|
&:first-of-type {
|
||||||
border-top: 1px solid rgba(255,255,255,0.2);
|
border-top: 1px solid rgba(255,255,255,0.2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
td {
|
||||||
padding: 0 1.2rem;
|
padding: 0 1.2rem;
|
||||||
@@ -25,6 +24,7 @@ table.contributor-list {
|
|||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.kredits {
|
&.kredits {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
.amount {
|
.amount {
|
||||||
@@ -36,4 +36,11 @@ table.contributor-list {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.current-user {
|
||||||
|
td {
|
||||||
|
background-color: rgba(255,255,255,0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-11
@@ -13,34 +13,37 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{{#if contractInteractionEnabled}}
|
{{#if proposalsOpen}}
|
||||||
{{#if proposalsOpen}}
|
|
||||||
<section id="proposals-open">
|
<section id="proposals-open">
|
||||||
<header>
|
<header>
|
||||||
<h2>Open Proposals</h2>
|
<h2>Open Proposals</h2>
|
||||||
</header>
|
</header>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{proposal-list proposals=proposalsOpenSorted confirmAction="confirmProposal"}}
|
{{proposal-list proposals=proposalsOpenSorted
|
||||||
|
confirmAction="confirmProposal"
|
||||||
|
contractInteractionEnabled=contractInteractionEnabled}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<section id="proposals-closed">
|
<section id="proposals-closed">
|
||||||
<header>
|
<header>
|
||||||
<h2>Closed Proposals</h2>
|
<h2>Closed Proposals</h2>
|
||||||
</header>
|
</header>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{proposal-list proposals=proposalsClosedSorted confirmAction="confirmProposal"}}
|
{{proposal-list proposals=proposalsClosedSorted
|
||||||
|
confirmAction="confirmProposal"}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="add-contributor">
|
<section id="add-contributor">
|
||||||
<header>
|
<header>
|
||||||
<h2>Add Contributor</h2>
|
<h2>Add Contributor</h2>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{add-contributor kredits=kredits}}
|
{{add-contributor kredits=kredits
|
||||||
|
contributors=model.contributors
|
||||||
|
contractInteractionEnabled=contractInteractionEnabled}}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{{/if}}
|
|
||||||
|
|||||||
+18
-5
@@ -1,6 +1,4 @@
|
|||||||
/* jshint node: true */
|
/* jshint node: true */
|
||||||
let contracts = require('../vendor/contract-abis');
|
|
||||||
|
|
||||||
module.exports = function(environment) {
|
module.exports = function(environment) {
|
||||||
var ENV = {
|
var ENV = {
|
||||||
modulePrefix: 'kredits-web',
|
modulePrefix: 'kredits-web',
|
||||||
@@ -23,18 +21,31 @@ module.exports = function(environment) {
|
|||||||
// when it is created
|
// when it is created
|
||||||
},
|
},
|
||||||
|
|
||||||
kreditsContract: {
|
browserify: {
|
||||||
ABI: contracts['Kredits'].abi
|
transform: [
|
||||||
|
["babelify", {
|
||||||
|
presets: ["es2015"],
|
||||||
|
global: true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
web3ProviderUrl: "https://parity.kosmos.org:8545",
|
||||||
|
ethereumChain: "testnet",
|
||||||
|
ipfs: {
|
||||||
|
host: 'localhost',
|
||||||
|
port: '5001',
|
||||||
|
protocol: 'http'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (environment === 'development') {
|
if (environment === 'development') {
|
||||||
ENV.kreditsContract.address = '0x9C68Af50e97f5605402B4C01e7aB836ed7145e8B';
|
|
||||||
// ENV.APP.LOG_RESOLVER = true;
|
// ENV.APP.LOG_RESOLVER = true;
|
||||||
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
||||||
// ENV.APP.LOG_TRANSITIONS = true;
|
// ENV.APP.LOG_TRANSITIONS = true;
|
||||||
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
||||||
// ENV.APP.LOG_VIEW_LOOKUPS = true;
|
// ENV.APP.LOG_VIEW_LOOKUPS = true;
|
||||||
|
ENV.ethereumChain = 'dev';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environment === 'test') {
|
if (environment === 'test') {
|
||||||
@@ -49,6 +60,8 @@ module.exports = function(environment) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (environment === 'production') {
|
if (environment === 'production') {
|
||||||
|
ENV.ethereumChain = 'testnet';
|
||||||
|
ENV.web3ProviderUrl = 'https://ropsten.infura.io';
|
||||||
}
|
}
|
||||||
|
|
||||||
return ENV;
|
return ENV;
|
||||||
|
|||||||
+11
-3
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "kredits-web",
|
"name": "kredits-web",
|
||||||
"version": "0.0.0",
|
"version": "0.1.0",
|
||||||
"description": "Small description for kredits-web goes here",
|
"description": "Small description for kredits-web goes here",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "",
|
"author": "",
|
||||||
@@ -10,11 +10,17 @@
|
|||||||
},
|
},
|
||||||
"repository": "",
|
"repository": "",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ember build",
|
|
||||||
"start": "ember server",
|
"start": "ember server",
|
||||||
"test": "ember test"
|
"test": "ember test",
|
||||||
|
"postinstall": "bower install",
|
||||||
|
"build": "ember build",
|
||||||
|
"build-prod": "ember build --environment production",
|
||||||
|
"update-version-file": "bash scripts/update-version-file.sh",
|
||||||
|
"deploy": "npm run build-prod && npm run update-version-file && bash scripts/deploy.sh"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"babel-preset-es2015": "^6.22.0",
|
||||||
|
"babelify": "^7.3.0",
|
||||||
"broccoli-asset-rev": "^2.4.5",
|
"broccoli-asset-rev": "^2.4.5",
|
||||||
"ember-ajax": "^2.4.1",
|
"ember-ajax": "^2.4.1",
|
||||||
"ember-browserify": "^1.1.13",
|
"ember-browserify": "^1.1.13",
|
||||||
@@ -35,6 +41,8 @@
|
|||||||
"ember-export-application-global": "^1.0.5",
|
"ember-export-application-global": "^1.0.5",
|
||||||
"ember-load-initializers": "^0.5.1",
|
"ember-load-initializers": "^0.5.1",
|
||||||
"ember-resolver": "^2.0.3",
|
"ember-resolver": "^2.0.3",
|
||||||
|
"ipfs-api": "^12.1.7",
|
||||||
|
"kredits-contracts": "67P/kredits-contracts",
|
||||||
"loader.js": "^4.0.10",
|
"loader.js": "^4.0.10",
|
||||||
"web3": "^0.18.2"
|
"web3": "^0.18.2"
|
||||||
},
|
},
|
||||||
|
|||||||
Executable
+20
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -xe
|
||||||
|
|
||||||
|
# Get revision from local master
|
||||||
|
rev=`git rev-parse HEAD`
|
||||||
|
short_rev=${rev:0:7}
|
||||||
|
# Check out build branch
|
||||||
|
git checkout build-production
|
||||||
|
# Copy from build dir to root
|
||||||
|
cp -r dist/* .
|
||||||
|
# Add all files
|
||||||
|
git add --all
|
||||||
|
# Commit build files
|
||||||
|
git commit -m "Build production from $short_rev"
|
||||||
|
# Push to remote
|
||||||
|
git push 5apps build-production:master
|
||||||
|
# Push build branch to collab repo
|
||||||
|
git push origin build-production:build-production
|
||||||
|
# Go back to previous branch
|
||||||
|
git checkout -
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PACKAGE_VERSION=$(cat package.json \
|
||||||
|
| grep version \
|
||||||
|
| head -1 \
|
||||||
|
| awk -F: '{ print $2 }' \
|
||||||
|
| sed 's/[",]//g' \
|
||||||
|
| tr -d '[[:space:]]')
|
||||||
|
|
||||||
|
echo $PACKAGE_VERSION > dist/VERSION
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
import { moduleForComponent, test } from 'ember-qunit';
|
// import { moduleForComponent, test } from 'ember-qunit';
|
||||||
import hbs from 'htmlbars-inline-precompile';
|
// import hbs from 'htmlbars-inline-precompile';
|
||||||
|
//
|
||||||
moduleForComponent('add-contributor', 'Integration | Component | add contributor', {
|
// moduleForComponent('add-contributor', 'Integration | Component | add contributor', {
|
||||||
integration: true
|
// integration: true
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
test('it renders', function(assert) {
|
// test('it renders', function(assert) {
|
||||||
|
//
|
||||||
// Set any properties with this.set('myProperty', 'value');
|
// // Set any properties with this.set('myProperty', 'value');
|
||||||
// Handle any actions with this.on('myAction', function(val) { ... });
|
// // Handle any actions with this.on('myAction', function(val) { ... });
|
||||||
|
//
|
||||||
this.render(hbs`{{add-contributor}}`);
|
// this.render(hbs`{{add-contributor}}`);
|
||||||
|
//
|
||||||
assert.equal(this.$().text().trim(), '');
|
// assert.equal(this.$().text().trim(), '');
|
||||||
});
|
// });
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
|
|
||||||
|
moduleFor('service:ipfs', 'Unit | Service | ipfs', {
|
||||||
|
// Specify the other units that are required for this test.
|
||||||
|
// needs: ['service:foo']
|
||||||
|
});
|
||||||
|
|
||||||
|
// Replace this with your real tests.
|
||||||
|
test('it exists', function(assert) {
|
||||||
|
let service = this.subject();
|
||||||
|
assert.ok(service);
|
||||||
|
});
|
||||||
Vendored
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user