diff --git a/app/components/add-contribution/component.js b/app/components/add-contribution/component.js index 56de353..96c4f48 100644 --- a/app/components/add-contribution/component.js +++ b/app/components/add-contribution/component.js @@ -1,13 +1,15 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; -import { and, notEmpty } from '@ember/object/computed'; +import { alias, and, notEmpty } from '@ember/object/computed'; import { assign } from '@ember/polyfills'; import moment from 'moment'; +import { inject as service } from '@ember/service'; export default Component.extend({ + kredits: service(), attributes: null, - contributors: Object.freeze([]), + contributors: alias('kredits.contributorsSorted'), isValidContributor: notEmpty('contributorId'), isValidKind: notEmpty('kind'), @@ -72,7 +74,5 @@ export default Component.extend({ }) .finally(() => this.set('inProgress', false)); } - } - }); diff --git a/app/services/kredits.js b/app/services/kredits.js index bcc32f4..0e1bcff 100644 --- a/app/services/kredits.js +++ b/app/services/kredits.js @@ -4,7 +4,7 @@ import Kredits from 'kredits-contracts'; import Service from '@ember/service'; import EmberObject from '@ember/object'; import { computed } from '@ember/object'; -import { alias, notEmpty } from '@ember/object/computed'; +import { alias, filterBy, notEmpty, sort } from '@ember/object/computed'; import { isEmpty, isPresent } from '@ember/utils'; import { inject as service } from '@ember/service'; @@ -39,6 +39,10 @@ export default Service.extend({ currentUserIsCore: alias('currentUser.isCore'), hasAccounts: notEmpty('currentUserAccounts'), + contributorsMined: filterBy('contributors', 'id'), + contributorsSorting: Object.freeze(['name:asc']), + contributorsSorted: sort('contributorsMined', 'contributorsSorting'), + // When data was loaded from cache, we need to fetch updates from the network contributorsNeedSync: false, contributionsNeedSync: false, diff --git a/app/templates/contributions/new.hbs b/app/templates/contributions/new.hbs index e0ecce3..984343f 100644 --- a/app/templates/contributions/new.hbs +++ b/app/templates/contributions/new.hbs @@ -6,8 +6,7 @@