536868002f
Just contributor ID, kind, and amount for now.
33 lines
879 B
JavaScript
33 lines
879 B
JavaScript
import Controller from '@ember/controller';
|
|
import { alias, filterBy, sort } from '@ember/object/computed';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default Controller.extend({
|
|
|
|
kredits: service(),
|
|
|
|
queryParams: ['contributorId', 'kind', 'amount'],
|
|
|
|
contributors: alias('kredits.contributors'),
|
|
minedContributors: filterBy('contributors', 'id'),
|
|
|
|
contributorsSorting: Object.freeze(['name:asc']),
|
|
sortedContributors: sort('minedContributors', 'contributorsSorting'),
|
|
|
|
actions: {
|
|
|
|
save (contribution) {
|
|
const contributor = this.contributors.findBy('id', contribution.contributorId);
|
|
contribution.contributorIpfsHash = contributor.ipfsHash;
|
|
|
|
return this.kredits.addContribution(contribution)
|
|
.then(contribution => {
|
|
this.transitionToRoute('index');
|
|
return contribution;
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
});
|