diff --git a/.template-lintrc.js b/.template-lintrc.js
index b45e96f..02bee12 100644
--- a/.template-lintrc.js
+++ b/.template-lintrc.js
@@ -1,5 +1,9 @@
'use strict';
module.exports = {
- extends: 'recommended'
+ extends: 'recommended',
+
+ rules: {
+ 'simple-unless': false
+ }
};
diff --git a/app/components/contribution-list/component.js b/app/components/contribution-list/component.js
index c490f86..f85da1d 100644
--- a/app/components/contribution-list/component.js
+++ b/app/components/contribution-list/component.js
@@ -5,16 +5,16 @@ export default Component.extend({
tagName: 'ul',
classNames: ['contribution-list'],
- // actions: {
- //
- // veto (contributionId) {
- // if (this.contractInteractionEnabled) {
- // this.vetoContribution(contributionId);
- // } else {
- // window.alert('Only members can veto contributions. Please ask someone to set you up.');
- // }
- // }
- //
- // }
+ actions: {
+
+ veto (contributionId) {
+ if (this.contractInteractionEnabled) {
+ this.vetoContribution(contributionId);
+ } else {
+ window.alert('Only members can veto contributions. Please ask someone to set you up.');
+ }
+ }
+
+ }
});
diff --git a/app/components/contribution-list/template.hbs b/app/components/contribution-list/template.hbs
index d53ad52..3a4aa90 100644
--- a/app/components/contribution-list/template.hbs
+++ b/app/components/contribution-list/template.hbs
@@ -1,5 +1,5 @@
{{#each contributions as |contribution|}}
-
+
{{user-avatar contributor=contribution.contributor}}
({{contribution.kind}})
@@ -14,5 +14,12 @@
{{contribution.amount}}₭S
+ {{#unless contribution.vetoed}}
+ {{#unless (is-confirmed-contribution contribution)}}
+
+
+
+ {{/unless}}
+ {{/unless}}
{{/each}}
\ No newline at end of file
diff --git a/app/controllers/index.js b/app/controllers/index.js
index 825a03d..d871450 100644
--- a/app/controllers/index.js
+++ b/app/controllers/index.js
@@ -33,10 +33,10 @@ export default Controller.extend({
actions: {
- vetoContribution (/* contributionId */) {
- // this.kredits.vote(proposalId).then(transaction => {
- // window.confirm('Vote submitted to Ethereum blockhain: '+transaction.hash);
- // });
+ vetoContribution (contributionId) {
+ this.kredits.veto(contributionId).then(transaction => {
+ window.confirm('Veto submitted to Ethereum blockhain: '+transaction.hash);
+ });
},
confirmProposal (proposalId) {
diff --git a/app/services/kredits.js b/app/services/kredits.js
index 12cd42c..f3358d1 100644
--- a/app/services/kredits.js
+++ b/app/services/kredits.js
@@ -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');
ethProvider = new ethers.providers.Web3Provider(web3Provider);
+ // const network = await ethProvider.getNetwork();
ethProvider.listAccounts().then(accounts => {
context.set('currentUserAccounts', accounts);
const ethSigner = accounts.length === 0 ? null : ethProvider.getSigner();
@@ -183,12 +184,22 @@ export default Service.extend({
console.debug('[kredits] vote for', proposalId);
return this.kredits.Proposal.functions.vote(proposalId)
- .then((data) => {
+ .then(data => {
console.debug('[kredits] vote response', 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() {
if (isEmpty(this.currentUserAccounts)) {
return RSVP.resolve();
diff --git a/app/styles/components/_contribution-list.scss b/app/styles/components/_contribution-list.scss
index 4cc0636..22452dc 100644
--- a/app/styles/components/_contribution-list.scss
+++ b/app/styles/components/_contribution-list.scss
@@ -20,14 +20,6 @@ ul.contribution-list {
font-size: 1.2rem;
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 {
align-self: center;
margin: 0;
@@ -37,14 +29,6 @@ ul.contribution-list {
&.kredits-amount, &.voting {
text-align: right;
}
-
- // &.description {
- // grid-column-start: span 2;
- // }
-
- // &.voting {
- // grid-column-start: span 2;
- // }
}
span {
@@ -96,6 +80,19 @@ ul.contribution-list {
color: $primary-color;
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;
+ }
}
}