Switch to contribution token instead of proposals
No vetos yet, and only for collections (not creation). closes #20
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { alias, filter, filterBy, sort } from '@ember/object/computed';
|
||||
import { alias, filter, sort } from '@ember/object/computed';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { computed } from '@ember/object';
|
||||
|
||||
export default Controller.extend({
|
||||
kredits: service(),
|
||||
currentBlock: alias('kredits.currentBlock'),
|
||||
|
||||
contributors: alias('kredits.contributors'),
|
||||
contributorsWithKredits: filter('contributors', function(contributor) {
|
||||
@@ -12,26 +14,44 @@ export default Controller.extend({
|
||||
contributorsSorting: Object.freeze(['balance:desc']),
|
||||
contributorsSorted: sort('contributorsWithKredits', 'contributorsSorting'),
|
||||
|
||||
proposals: alias('kredits.proposals'),
|
||||
proposalsOpen: filterBy('proposals', 'isExecuted', false),
|
||||
proposalsClosed: filterBy('proposals', 'isExecuted', true),
|
||||
proposalsSorting: Object.freeze(['id:desc']),
|
||||
proposalsClosedSorted: sort('proposalsClosed', 'proposalsSorting'),
|
||||
proposalsOpenSorted: sort('proposalsOpen', 'proposalsSorting'),
|
||||
contributions: alias('kredits.contributions'),
|
||||
contributionsSorting: Object.freeze(['id:desc']),
|
||||
|
||||
contributionsUnconfirmed: computed('contributions.[]', 'currentBlock', function() {
|
||||
return this.contributions.filter(contribution => {
|
||||
return contribution.confirmedAt < this.currentBlock;
|
||||
});
|
||||
}),
|
||||
contributionsConfirmed: computed('contributions.[]', 'currentBlock', function() {
|
||||
return this.contributions.filter(contribution => {
|
||||
return contribution.confirmedAt >= this.currentBlock;
|
||||
});
|
||||
}),
|
||||
|
||||
contributionsUnconfirmedSorted: sort('contributionsUnconfirmed', 'contributionsSorting'),
|
||||
contributionsConfirmedSorted: sort('contributionsConfirmed', 'contributionsSorting'),
|
||||
|
||||
actions: {
|
||||
confirmProposal(proposalId) {
|
||||
|
||||
vetoContribution (/* contributionId */) {
|
||||
// this.kredits.vote(proposalId).then(transaction => {
|
||||
// window.confirm('Vote submitted to Ethereum blockhain: '+transaction.hash);
|
||||
// });
|
||||
},
|
||||
|
||||
confirmProposal (proposalId) {
|
||||
this.kredits.vote(proposalId).then(transaction => {
|
||||
window.confirm('Vote submitted to Ethereum blockhain: '+transaction.hash);
|
||||
});
|
||||
},
|
||||
|
||||
save(contributor) {
|
||||
save (contributor) {
|
||||
return this.kredits.addContributor(contributor)
|
||||
.then((contributor) => {
|
||||
this.contributors.pushObject(contributor);
|
||||
return contributor;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user