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:
@@ -15,4 +15,8 @@ export default Route.extend({
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
afterModel() {
|
||||
return this.get('kredits').loadContributorsAndProposals();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
|
||||
kredits: Ember.inject.service(),
|
||||
|
||||
model() {
|
||||
let newContributor = Ember.getOwner(this).lookup('model:contributor');
|
||||
newContributor.set('kind', 'person');
|
||||
|
||||
let kredits = this.get('kredits');
|
||||
let totalSupply = kredits.get('kredits').Token.functions.totalSupply();
|
||||
|
||||
return Ember.RSVP.hash({
|
||||
contributors: kredits.getContributors(),
|
||||
proposals: kredits.getProposals(),
|
||||
totalSupply,
|
||||
newContributor: newContributor,
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1,15 +0,0 @@
|
||||
import injectService from 'ember-service/inject';
|
||||
import Route from 'ember-route';
|
||||
|
||||
export default Route.extend({
|
||||
kredits: injectService(),
|
||||
|
||||
setupController(controller) {
|
||||
this._super(...arguments);
|
||||
|
||||
this.get('kredits').getContributors()
|
||||
.then((contributors) => {
|
||||
controller.set('contributors', contributors);
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user