Add contributor and kredits count to page

This commit is contained in:
2017-01-31 17:28:33 +08:00
parent 4dbeded613
commit e29ffdc319
4 changed files with 65 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
import Ember from 'ember';
const {
computed
} = Ember;
export default Ember.Controller.extend({
contributorsCount: computed('model.contributors.[]', function() {
return this.get('model.contributors').length;
}),
kreditsSum: computed('model.contributors.[]', function() {
let kredits = this.get('model.contributors').mapBy('kredits');
return kredits.reduce(function(previousValue, currentValue) {
return currentValue + previousValue;
});
})
});