Move contributors + proposals to service

With this change we have all the contributors + proposals all the time in one place and can update them via events.
This commit is contained in:
2018-04-15 19:02:57 +02:00
parent fdda30da67
commit 99bbcda709
11 changed files with 36 additions and 78 deletions
+8 -2
View File
@@ -1,8 +1,11 @@
import EmberObject from 'ember-object';
import { alias } from 'ember-computed';
import computed, { alias } from 'ember-computed';
import injectService from 'ember-service/inject';
import bignumber from 'kredits-web/utils/cps/bignumber';
export default EmberObject.extend({
kredits: injectService(),
// Contract
id: bignumber('idRaw', 'toString'),
creatorAddress: null,
@@ -24,5 +27,8 @@ export default EmberObject.extend({
ipfsData: '',
// Relationships
contributor: null,
// TODO: Optimize it. We don't need to find the contributor every time we add a new one
contributor: computed('recipientId', 'kredits.contributors.[]', function() {
return this.get('kredits.contributors').findBy('id', this.get('recipientId'));
})
});