Show open/closed proposals
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
|
||||||
|
});
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<ul>
|
||||||
|
{{#each proposals as |proposal|}}
|
||||||
|
<li>
|
||||||
|
Issue{{#if proposal.executed}}d{{/if}}
|
||||||
|
<span class="amount">{{proposal.amount}}</span>
|
||||||
|
<span class="symbol">₭S</span>
|
||||||
|
to
|
||||||
|
<span class="recipient">{{proposal.recipientName}}</span>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
@@ -13,4 +13,30 @@ export default Ember.Controller.extend({
|
|||||||
|
|
||||||
contractInteractionEnabled: computed.alias('kredits.web3Provided'),
|
contractInteractionEnabled: computed.alias('kredits.web3Provided'),
|
||||||
|
|
||||||
|
proposalsOpen: function() {
|
||||||
|
let proposals = this.get('model.proposals')
|
||||||
|
.filterBy('executed', false)
|
||||||
|
.map(p => {
|
||||||
|
p.recipientName = this.findContributorByAddress(p.recipientAddress).github_username;
|
||||||
|
return p;
|
||||||
|
});
|
||||||
|
return proposals;
|
||||||
|
}.property('model.proposals.[]', 'model.contributors.[]'),
|
||||||
|
|
||||||
|
proposalsClosed: function() {
|
||||||
|
let proposals = this.get('model.proposals')
|
||||||
|
.filterBy('executed', true)
|
||||||
|
.map(p => {
|
||||||
|
p.recipientName = this.findContributorByAddress(p.recipientAddress).github_username;
|
||||||
|
return p;
|
||||||
|
});
|
||||||
|
return proposals;
|
||||||
|
}.property('model.proposals.[]', 'model.contributors.[]'),
|
||||||
|
|
||||||
|
findContributorByAddress(address) {
|
||||||
|
return this.get('model.contributors')
|
||||||
|
.findBy('address', address);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export default Ember.Object.extend({
|
|||||||
github_username: null,
|
github_username: null,
|
||||||
github_uid: null,
|
github_uid: null,
|
||||||
kredits: null,
|
kredits: null,
|
||||||
|
address: null,
|
||||||
|
|
||||||
avatarURL: function() {
|
avatarURL: function() {
|
||||||
return `https\:\/\/avatars2.githubusercontent.com/u/${this.get('github_uid')}?v=3&s=128`;
|
return `https\:\/\/avatars2.githubusercontent.com/u/${this.get('github_uid')}?v=3&s=128`;
|
||||||
|
|||||||
@@ -13,6 +13,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
{{#if proposalsOpen}}
|
||||||
|
<section id="proposals-open">
|
||||||
|
<header>
|
||||||
|
<h2>Open Proposals</h2>
|
||||||
|
</header>
|
||||||
|
<div class="content">
|
||||||
|
{{proposal-list proposals=proposalsOpen}}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<section id="proposals-closed">
|
||||||
|
<header>
|
||||||
|
<h2>Closed Proposals</h2>
|
||||||
|
</header>
|
||||||
|
<div class="content">
|
||||||
|
{{proposal-list proposals=proposalsClosed}}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
{{#if contractInteractionEnabled}}
|
{{#if contractInteractionEnabled}}
|
||||||
<section id="add-contributor">
|
<section id="add-contributor">
|
||||||
<header>
|
<header>
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { moduleForComponent, test } from 'ember-qunit';
|
||||||
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
|
|
||||||
|
moduleForComponent('proposal-list', 'Integration | Component | proposal list', {
|
||||||
|
integration: true
|
||||||
|
});
|
||||||
|
|
||||||
|
test('it renders', function(assert) {
|
||||||
|
|
||||||
|
// Set any properties with this.set('myProperty', 'value');
|
||||||
|
// Handle any actions with this.on('myAction', function(val) { ... });
|
||||||
|
|
||||||
|
this.render(hbs`{{proposal-list}}`);
|
||||||
|
|
||||||
|
assert.equal(this.$().text().trim(), '');
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user