Add contributor and kredits count to page
This commit is contained in:
@@ -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;
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
@@ -21,6 +21,7 @@ $font-family-sans: 'Open Sans', sans-serif;
|
||||
body {
|
||||
background-image: url('/img/bg.jpg');
|
||||
background-repeat: none;
|
||||
background-attachment: fixed;
|
||||
font-family: $font-family-sans;
|
||||
font-size: 16px;
|
||||
font-weight: 300;
|
||||
@@ -47,6 +48,20 @@ section {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
&#contributors {
|
||||
.content {
|
||||
p.stats {
|
||||
padding-top: 2rem;
|
||||
font-size: 1rem;
|
||||
color: lightblue;
|
||||
text-align: center;
|
||||
span.number {
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@import "components/contributor-list";
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
|
||||
<div class="content">
|
||||
{{contributor-list contributors=model.contributors}}
|
||||
|
||||
<p class="stats">
|
||||
<span class="number">{{kreditsSum}}</span> kredits issued and distributed among
|
||||
<span class="number">{{contributorsCount}}</span> contributors.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user