Veto contributions
This commit is contained in:
+5
-1
@@ -1,5 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: 'recommended'
|
extends: 'recommended',
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'simple-unless': false
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ export default Component.extend({
|
|||||||
tagName: 'ul',
|
tagName: 'ul',
|
||||||
classNames: ['contribution-list'],
|
classNames: ['contribution-list'],
|
||||||
|
|
||||||
// actions: {
|
actions: {
|
||||||
//
|
|
||||||
// veto (contributionId) {
|
veto (contributionId) {
|
||||||
// if (this.contractInteractionEnabled) {
|
if (this.contractInteractionEnabled) {
|
||||||
// this.vetoContribution(contributionId);
|
this.vetoContribution(contributionId);
|
||||||
// } else {
|
} else {
|
||||||
// window.alert('Only members can veto contributions. Please ask someone to set you up.');
|
window.alert('Only members can veto contributions. Please ask someone to set you up.');
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{{#each contributions as |contribution|}}
|
{{#each contributions as |contribution|}}
|
||||||
<li data-contribution-id={{contribution.id}} class={{if contribution.confirmed "confirmed" "unconfirmed"}}>
|
<li data-contribution-id={{contribution.id}} class={{contribution-status contribution}}>
|
||||||
<p class="meta">
|
<p class="meta">
|
||||||
<span class="recipient">{{user-avatar contributor=contribution.contributor}}</span>
|
<span class="recipient">{{user-avatar contributor=contribution.contributor}}</span>
|
||||||
<span class="category {{contribution.kind}}">({{contribution.kind}})</span>
|
<span class="category {{contribution.kind}}">({{contribution.kind}})</span>
|
||||||
@@ -14,5 +14,12 @@
|
|||||||
<p class="kredits-amount">
|
<p class="kredits-amount">
|
||||||
<span class="amount">{{contribution.amount}}</span><span class="symbol">₭S</span>
|
<span class="amount">{{contribution.amount}}</span><span class="symbol">₭S</span>
|
||||||
</p>
|
</p>
|
||||||
|
{{#unless contribution.vetoed}}
|
||||||
|
{{#unless (is-confirmed-contribution contribution)}}
|
||||||
|
<p class="voting">
|
||||||
|
<button {{action "veto" contribution.id}} class="small danger">veto</button>
|
||||||
|
</p>
|
||||||
|
{{/unless}}
|
||||||
|
{{/unless}}
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@@ -33,10 +33,10 @@ export default Controller.extend({
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
vetoContribution (/* contributionId */) {
|
vetoContribution (contributionId) {
|
||||||
// this.kredits.vote(proposalId).then(transaction => {
|
this.kredits.veto(contributionId).then(transaction => {
|
||||||
// window.confirm('Vote submitted to Ethereum blockhain: '+transaction.hash);
|
window.confirm('Veto submitted to Ethereum blockhain: '+transaction.hash);
|
||||||
// });
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
confirmProposal (proposalId) {
|
confirmProposal (proposalId) {
|
||||||
|
|||||||
+13
-2
@@ -52,9 +52,10 @@ export default Service.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function instantiateWithAccount (web3Provider, context) {
|
async function instantiateWithAccount (web3Provider, context) {
|
||||||
console.debug('[kredits] Using user-provided instance, e.g. from Mist browser or Metamask');
|
console.debug('[kredits] Using user-provided instance, e.g. from Mist browser or Metamask');
|
||||||
ethProvider = new ethers.providers.Web3Provider(web3Provider);
|
ethProvider = new ethers.providers.Web3Provider(web3Provider);
|
||||||
|
// const network = await ethProvider.getNetwork();
|
||||||
ethProvider.listAccounts().then(accounts => {
|
ethProvider.listAccounts().then(accounts => {
|
||||||
context.set('currentUserAccounts', accounts);
|
context.set('currentUserAccounts', accounts);
|
||||||
const ethSigner = accounts.length === 0 ? null : ethProvider.getSigner();
|
const ethSigner = accounts.length === 0 ? null : ethProvider.getSigner();
|
||||||
@@ -183,12 +184,22 @@ export default Service.extend({
|
|||||||
console.debug('[kredits] vote for', proposalId);
|
console.debug('[kredits] vote for', proposalId);
|
||||||
|
|
||||||
return this.kredits.Proposal.functions.vote(proposalId)
|
return this.kredits.Proposal.functions.vote(proposalId)
|
||||||
.then((data) => {
|
.then(data => {
|
||||||
console.debug('[kredits] vote response', data);
|
console.debug('[kredits] vote response', data);
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
veto(contributionId) {
|
||||||
|
console.debug('[kredits] veto against', contributionId);
|
||||||
|
|
||||||
|
return this.kredits.Contribution.functions.veto(contributionId)
|
||||||
|
.then(data => {
|
||||||
|
console.debug('[kredits] veto response', data);
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getCurrentUser: computed('kredits.provider', function() {
|
getCurrentUser: computed('kredits.provider', function() {
|
||||||
if (isEmpty(this.currentUserAccounts)) {
|
if (isEmpty(this.currentUserAccounts)) {
|
||||||
return RSVP.resolve();
|
return RSVP.resolve();
|
||||||
|
|||||||
@@ -20,14 +20,6 @@ ul.contribution-list {
|
|||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
border-bottom: 1px solid rgba(255,255,255,0.2);
|
border-bottom: 1px solid rgba(255,255,255,0.2);
|
||||||
|
|
||||||
&.unconfirmed {
|
|
||||||
grid-template-columns: auto 5rem 5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:first-of-type {
|
|
||||||
border-top: 1px solid rgba(255,255,255,0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
p {
|
||||||
align-self: center;
|
align-self: center;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -37,14 +29,6 @@ ul.contribution-list {
|
|||||||
&.kredits-amount, &.voting {
|
&.kredits-amount, &.voting {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
// &.description {
|
|
||||||
// grid-column-start: span 2;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// &.voting {
|
|
||||||
// grid-column-start: span 2;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
@@ -96,6 +80,19 @@ ul.contribution-list {
|
|||||||
color: $primary-color;
|
color: $primary-color;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:first-of-type {
|
||||||
|
border-top: 1px solid rgba(255,255,255,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.unconfirmed {
|
||||||
|
grid-template-columns: auto 5rem 5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.vetoed {
|
||||||
|
text-decoration: line-through;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user