From a7bfa3e45c1f2ec5791fcc4b647a509d597e9d5d Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Sun, 5 Feb 2017 17:56:14 +0800 Subject: [PATCH] Sort all data --- app/controllers/index.js | 15 +++++++++++---- app/templates/index.hbs | 6 +++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/controllers/index.js b/app/controllers/index.js index c8fab5c..e50524d 100644 --- a/app/controllers/index.js +++ b/app/controllers/index.js @@ -13,6 +13,11 @@ export default Ember.Controller.extend({ contractInteractionEnabled: computed.alias('kredits.web3Provided'), + findContributorByAddress(address) { + return this.get('model.contributors') + .findBy('address', address); + }, + proposalsOpen: function() { let proposals = this.get('model.proposals') .filterBy('executed', false) @@ -33,10 +38,12 @@ export default Ember.Controller.extend({ return proposals; }.property('model.proposals.[]', 'model.contributors.[]'), - findContributorByAddress(address) { - return this.get('model.contributors') - .findBy('address', address); - }, + proposalsSorting: ['id:desc'], + proposalsClosedSorted: Ember.computed.sort('proposalsClosed', 'proposalsSorting'), + proposalsOpenSorted: Ember.computed.sort('proposalsOpen', 'proposalsSorting'), + + contributorsSorting: ['kredits:desc'], + contributorsSorted: Ember.computed.sort('model.contributors', 'contributorsSorting'), actions: { diff --git a/app/templates/index.hbs b/app/templates/index.hbs index 16df444..c365322 100644 --- a/app/templates/index.hbs +++ b/app/templates/index.hbs @@ -4,7 +4,7 @@
- {{contributor-list contributors=model.contributors}} + {{contributor-list contributors=contributorsSorted}}

{{model.totalSupply}} kredits issued and distributed among @@ -20,7 +20,7 @@

Open Proposals

- {{proposal-list proposals=proposalsOpen confirmAction="confirmProposal"}} + {{proposal-list proposals=proposalsOpenSorted confirmAction="confirmProposal"}}
{{/if}} @@ -30,7 +30,7 @@

Closed Proposals

- {{proposal-list proposals=proposalsClosed confirmAction="confirmProposal"}} + {{proposal-list proposals=proposalsClosedSorted confirmAction="confirmProposal"}}