diff --git a/app/components/add-proposal/component.js b/app/components/add-proposal/component.js
deleted file mode 100644
index 2e65fdf..0000000
--- a/app/components/add-proposal/component.js
+++ /dev/null
@@ -1,64 +0,0 @@
-import Component from '@ember/component';
-import { computed } from '@ember/object';
-import { and, notEmpty } from '@ember/object/computed';
-
-export default Component.extend({
-
- attributes: null,
- contributors: Object.freeze([]),
-
- isValidContributor: notEmpty('contributorId'),
- isValidAmount: computed('amount', function() {
- return parseInt(this.amount, 10) > 0;
- }),
- isValidDescription: notEmpty('description'),
- isValidUrl: notEmpty('url'),
- isValid: and('isValidContributor',
- 'isValidAmount',
- 'isValidDescription'),
-
- init () {
- this._super(...arguments);
-
- // Default attributes used by reset
- this.set('attributes', {
- contributorId: null,
- kind: 'community',
- amount: null,
- description: null,
- url: null,
- });
- },
-
- didInsertElement() {
- this._super(...arguments);
- this.reset();
- },
-
- reset: function() {
- this.setProperties(this.attributes);
- },
-
- actions: {
- submit() {
- if (!this.isValid) {
- alert('Invalid data. Please review and try again.');
- return;
- }
-
- let attributes = Object.keys(this.attributes);
- let proposal = this.getProperties(attributes);
- let saved = this.save(proposal);
-
- // The promise handles inProgress
- this.set('inProgress', saved);
-
- saved.then(() => {
- this.reset();
- window.scroll(0,0);
- window.alert('Proposal added.');
- });
- }
- }
-
-});
diff --git a/app/components/add-proposal/template.hbs b/app/components/add-proposal/template.hbs
deleted file mode 100644
index 4cf6f21..0000000
--- a/app/components/add-proposal/template.hbs
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
diff --git a/app/components/proposal-list/component.js b/app/components/proposal-list/component.js
deleted file mode 100644
index 272e28e..0000000
--- a/app/components/proposal-list/component.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import Component from '@ember/component';
-
-export default Component.extend({
-
- tagName: 'ul',
- classNames: ['proposal-list'],
-
- actions: {
-
- confirm(proposalId) {
- if (this.contractInteractionEnabled) {
- this.confirmProposal(proposalId);
- } else {
- window.alert('Only members can vote on proposals. Please ask someone to set you up.');
- }
- }
-
- }
-
-});
diff --git a/app/components/proposal-list/template.hbs b/app/components/proposal-list/template.hbs
deleted file mode 100644
index 9dfe857..0000000
--- a/app/components/proposal-list/template.hbs
+++ /dev/null
@@ -1,20 +0,0 @@
-{{#each proposals as |proposal|}}
-
-
- ♥ ({{proposal.kind}})
- {{proposal.contributor.name}}:
-
-
- {{proposal.amount}}₭S
-
-
- {{proposal.description}}
-
-
- {{#unless proposal.isExecuted}}
- ({{proposal.votesCount}}/{{proposal.votesNeeded}} votes)
-
- {{/unless}}
-
-
-{{/each}}
diff --git a/app/controllers/dashboard.js b/app/controllers/dashboard.js
index e8f49d6..433a0cb 100644
--- a/app/controllers/dashboard.js
+++ b/app/controllers/dashboard.js
@@ -45,12 +45,6 @@ export default Controller.extend({
});
},
- confirmProposal (proposalId) {
- this.kredits.vote(proposalId).then(transaction => {
- console.debug('[controllers:index] Vote submitted to Ethereum blockhain: '+transaction.hash);
- });
- },
-
toggleQuickFilterUnconfirmed () {
this.toggleProperty('showQuickFilterUnconfirmed');
},
diff --git a/app/controllers/proposals/new.js b/app/controllers/proposals/new.js
deleted file mode 100644
index 61c93ae..0000000
--- a/app/controllers/proposals/new.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import Controller from '@ember/controller';
-import { alias, filterBy } from '@ember/object/computed';
-import { inject as service } from '@ember/service';
-
-export default Controller.extend({
- kredits: service(),
-
- contributors: alias('kredits.contributors'),
- minedContributors: filterBy('contributors', 'id'),
-
- actions: {
- save(proposal) {
- // contributorIpfsHash is needed for the proposal ipfs data. I'm not happy to do this here but I think to load all the contributors in addProposal again is a bit too much. I hope we can refactor it later.
- let contributor = this.contributors.findBy('id', proposal.contributorId);
- proposal.contributorIpfsHash = contributor.get('ipfsHash');
-
- return this.kredits.addProposal(proposal)
- .then((proposal) => {
- this.transitionToRoute('index');
- return proposal;
- });
- }
- }
-});
diff --git a/app/models/proposal.js b/app/models/proposal.js
deleted file mode 100644
index 6cd872e..0000000
--- a/app/models/proposal.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import EmberObject from '@ember/object';
-import { alias } from '@ember/object/computed';
-import bignumber from 'kredits-web/utils/cps/bignumber';
-
-export default EmberObject.extend({
-
- // Contract
- id: bignumber('idRaw', 'toString'),
- creatorAccount: null,
- contributorId: bignumber('contributorIdRaw', 'toString'),
- amount: bignumber('amountRaw', 'toNumber'),
- votesCount: bignumber('votesCountRaw', 'toNumber'),
- votesNeeded: bignumber('votesNeededRaw', 'toNumber'),
- executed: null,
- ipfsHash: null,
-
- // Shortcuts
- isExecuted: alias('executed'),
-
- // IPFS
- kind: null,
- description: null,
- details: null,
- url: null,
- ipfsData: '',
-
- init () {
- this._super(...arguments);
- this.set('details', {});
- }
-
-});
diff --git a/app/router.js b/app/router.js
index 636369a..578bb62 100644
--- a/app/router.js
+++ b/app/router.js
@@ -16,9 +16,6 @@ Router.map(function() {
this.route('show', { path: ':id' });
});
});
- this.route('proposals', function() {
- this.route('new');
- });
this.route('contributions', function() {
this.route('new', { queryParams: ['contributorId', 'kind', 'amount'] });
this.route('resubmit', { path: ':id/resubmit' });
diff --git a/app/services/kredits.js b/app/services/kredits.js
index 87dcb50..2c6773c 100644
--- a/app/services/kredits.js
+++ b/app/services/kredits.js
@@ -13,7 +13,6 @@ import formatKredits from 'kredits-web/utils/format-kredits';
import config from 'kredits-web/config/environment';
import Contributor from 'kredits-web/models/contributor'
-import Proposal from 'kredits-web/models/proposal'
import Contribution from 'kredits-web/models/contribution'
export default Service.extend({
@@ -23,7 +22,6 @@ export default Service.extend({
currentUser: null,
contributors: null,
contributions: null,
- proposals: null,
githubAccessToken: null,
currentUserIsContributor: notEmpty('currentUser'),
@@ -77,7 +75,6 @@ export default Service.extend({
init () {
this._super(...arguments);
this.set('contributors', []);
- this.set('proposals', []);
this.set('contributions', []);
},
@@ -232,31 +229,6 @@ export default Service.extend({
});
},
- //
- // TODO Implement proposals with voting
- //
-
- // addProposal (attributes) {
- // console.debug('[kredits] add proposal', attributes);
- //
- // return this.kredits.Proposal.addProposal(attributes)
- // .then((data) => {
- // console.debug('[kredits] add proposal response', data);
- // attributes.contributor = this.contributors.findBy('id', attributes.contributorId);
- // return Proposal.create(attributes);
- // });
- // },
-
- // getProposals () {
- // return this.kredits.Proposal.all()
- // .then(proposals => {
- // return proposals.map(proposal => {
- // proposal.contributor = this.contributors.findBy('id', proposal.contributorId.toString());
- // return Proposal.create(proposal);
- // });
- // });
- // },
-
getContributions () {
return this.kredits.Contribution.all({page: {size: 200}})
.then(contributions => {
@@ -267,16 +239,6 @@ export default Service.extend({
});
},
- vote (proposalId) {
- console.debug('[kredits] vote for', proposalId);
-
- return this.kredits.Proposal.functions.vote(proposalId)
- .then(data => {
- console.debug('[kredits] vote response', data);
- return data;
- });
- },
-
veto (contributionId) {
console.debug('[kredits] veto against', contributionId);
const contribution = this.contributions.findBy('id', contributionId);
@@ -305,10 +267,6 @@ export default Service.extend({
});
}),
- findProposalById(proposalId) {
- return this.proposals.findBy('id', proposalId.toString());
- },
-
// Contract events
addContractEventHandlers () {
this.kredits.Contributor
@@ -320,11 +278,6 @@ export default Service.extend({
.on('ContributionAdded', this.handleContributionAdded.bind(this))
.on('ContributionVetoed', this.handleContributionVetoed.bind(this))
- this.kredits.Proposal
- .on('ProposalCreated', this.handleProposalCreated.bind(this))
- .on('ProposalVoted', this.handleProposalVoted.bind(this))
- .on('ProposalExecuted', this.handleProposalExecuted.bind(this));
-
this.kredits.Token
.on('Transfer', this.handleTransfer.bind(this));
},
@@ -374,45 +327,6 @@ export default Service.extend({
}
},
- handleProposalCreated (proposalId) {
- let proposal = this.findProposalById(proposalId);
-
- if (proposal) {
- console.debug('[events] proposal exists, not adding from event');
- return;
- }
-
- this.kredits.Proposal.getById(proposalId)
- .then((proposal) => {
- proposal.contributor = this.contributors.findBy('id', proposal.contributorId.toString());
- this.proposals.pushObject(Proposal.create(proposal));
- });
- },
-
- // TODO: We may want to reload that proposal to show the voter as voted
- handleProposalVoted (proposalId, voterId, totalVotes) {
- let proposal = this.findProposalById(proposalId);
-
- if (proposal) {
- proposal.set('votesCount', totalVotes);
- }
- },
-
- handleProposalExecuted (proposalId, contributorId, amount) {
- let proposal = this.findProposalById(proposalId);
-
- if (proposal.get('isExecuted')) {
- console.debug('[events] proposal already executed, not adding from event');
- return;
- }
-
- proposal.set('executed', true);
-
- this.contributors
- .findBy('id', contributorId.toString())
- .incrementProperty('balance', amount);
- },
-
handleTransfer (from, to, value) {
value = value.toNumber();
diff --git a/app/styles/_forms.scss b/app/styles/_forms.scss
index 1de0966..5153b02 100644
--- a/app/styles/_forms.scss
+++ b/app/styles/_forms.scss
@@ -1,6 +1,5 @@
section#add-contributor,
section#add-contribution,
-section#add-proposal,
section#signup {
form {
@@ -11,7 +10,7 @@ section#signup {
&.mg-bottom-md {
margin-bottom: 2rem;
}
-
+
&.label {
margin-bottom: .5rem;
}
diff --git a/app/styles/app.scss b/app/styles/app.scss
index 03d3306..364dd7a 100644
--- a/app/styles/app.scss
+++ b/app/styles/app.scss
@@ -76,22 +76,6 @@ section {
}
}
}
-
- proposals-open, proposals-closed {
- .actions {
- padding-top: 3rem;
- font-size: 1rem;
- color: $primary-color;
- text-align: center;
- @include media-max(small) {
- padding-top: 2rem;
- }
-
- a {
- color: $primary-color;
- }
- }
- }
}
@media (min-width: 550px) {
@@ -111,7 +95,6 @@ section {
@import "components/contributor-profile";
@import "components/external-account-link";
@import "components/loading-spinner";
-@import "components/proposal-list";
@import "components/topbar";
@import "components/topbar-account-panel";
@import "components/user-avatar";
diff --git a/app/styles/components/_contribution-list.scss b/app/styles/components/_contribution-list.scss
index e886f2e..9cfee0e 100644
--- a/app/styles/components/_contribution-list.scss
+++ b/app/styles/components/_contribution-list.scss
@@ -115,37 +115,3 @@ ul.contribution-list {
}
}
-
-@media (min-width: 550px) {
- ul.proposal-list {
- li {
- grid-template-columns: auto 10rem;
- grid-row-gap: 0.5rem;
-
- p {
- &.kredits-amount, &.voting {
- text-align: right;
- }
- }
-
- &.unconfirmed {
- p {
- &.kredits-amount, &.voting {
- text-align: right;
- }
-
- &.description {
- grid-column-start: span 1;
- }
-
- &.voting {
- grid-column-start: span 1;
- }
- }
- }
-
- .description {
- }
- }
- }
-}
diff --git a/app/styles/components/_proposal-list.scss b/app/styles/components/_proposal-list.scss
deleted file mode 100644
index 0ab5fd9..0000000
--- a/app/styles/components/_proposal-list.scss
+++ /dev/null
@@ -1,111 +0,0 @@
-ul.proposal-list {
- clear: both;
- width: 100%;
- list-style: none;
-
- li {
- display: grid;
- grid-template-columns: auto 5rem;
- grid-row-gap: 0.5rem;
- padding: 1rem 1.2rem;
- background-color: rgba(255,255,255,0.1);
- font-size: 1.2rem;
- border-bottom: 1px solid rgba(255,255,255,0.2);
-
- &:first-of-type {
- border-top: 1px solid rgba(255,255,255,0.2);
- }
-
- p {
- align-self: center;
- margin: 0;
- line-height: 2rem;
-
- &.kredits-amount, &.voting {
- text-align: right;
- }
-
- &.description {
- grid-column-start: span 2;
- }
-
- &.voting {
- grid-column-start: span 2;
- }
- }
-
- span {
- }
-
- .description {
- line-height: 1.4em;
- font-size: 1rem;
- }
-
- .category {
- color: $blue;
- padding-right: 0.2rem;
- &.community { color: $red; }
- &.dev { color: $pink; }
- &.design { color: $yellow; }
- &.docs { color: $green; }
- &.ops { color: $purple; }
- }
-
- .amount {
- font-weight: 500;
- }
-
- .symbol {
- font-size: 1rem;
- font-weight: 500;
- padding-left: 0.2rem;
- }
-
- .recipient {
- font-weight: 500;
- }
-
- .votes {
- font-size: 1rem;
- color: $primary-color;
- margin-right: 0.5rem;
- }
- }
-
-}
-
-@media (min-width: 550px) {
- ul.proposal-list {
- li {
- grid-template-columns: auto 10rem;
- grid-row-gap: 0.5rem;
-
- p {
- &.kredits-amount, &.voting {
- text-align: right;
- }
- }
-
- &.unconfirmed {
- p {
- &.kredits-amount, &.voting {
- text-align: right;
- }
-
- &.description {
- grid-column-start: span 1;
- }
-
- &.voting {
- grid-column-start: span 1;
- }
- }
- }
-
-
- .description {
- }
- }
- }
-}
diff --git a/app/templates/proposals/new.hbs b/app/templates/proposals/new.hbs
deleted file mode 100644
index 0582812..0000000
--- a/app/templates/proposals/new.hbs
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
diff --git a/tests/integration/components/add-proposal/component-test.js b/tests/integration/components/add-proposal/component-test.js
deleted file mode 100644
index 4dd31d0..0000000
--- a/tests/integration/components/add-proposal/component-test.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { module, test } from 'qunit';
-import { setupRenderingTest } from 'ember-qunit';
-import { render } from '@ember/test-helpers';
-import hbs from 'htmlbars-inline-precompile';
-
-module('Integration | Component | add proposal', function(hooks) {
- setupRenderingTest(hooks);
-
- test('it renders', async function(assert) {
-
- // Set any properties with this.set('myProperty', 'value');
- // Handle any actions with this.on('myAction', function(val) { ... });
-
- await render(hbs`{{add-proposal}}`);
-
- assert.dom('.actions a').hasText('Back');
- });
-});
diff --git a/tests/integration/components/chart-contributions-by-type/component-test.js b/tests/integration/components/chart-contributions-by-type/component-test.js
index fbe6a4f..e2411ea 100644
--- a/tests/integration/components/chart-contributions-by-type/component-test.js
+++ b/tests/integration/components/chart-contributions-by-type/component-test.js
@@ -6,7 +6,7 @@ import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | chart-contributions-by-type', function(hooks) {
setupRenderingTest(hooks);
- let proposals = [
+ let contributions = [
{ kind: 'dev', amount: 500 },
{ kind: 'dev', amount: 1500 },
{ kind: 'ops', amount: 1500 },
@@ -20,9 +20,9 @@ module('Integration | Component | chart-contributions-by-type', function(hooks)
];
test('it renders', async function(assert) {
- this.set('proposals', proposals);
+ this.set('contributions', contributions);
- await render(hbs`{{chart-contributions-by-type contributions=proposals}}`);
+ await render(hbs`{{chart-contributions-by-type contributions=contributions}}`);
assert.dom(this.element).hasText('');
});
diff --git a/tests/integration/components/proposal-list/component-test.js b/tests/integration/components/proposal-list/component-test.js
deleted file mode 100644
index c633ab1..0000000
--- a/tests/integration/components/proposal-list/component-test.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { module, test } from 'qunit';
-import { setupRenderingTest } from 'ember-qunit';
-import { render } from '@ember/test-helpers';
-import hbs from 'htmlbars-inline-precompile';
-
-module('Integration | Component | proposal list', function(hooks) {
- setupRenderingTest(hooks);
-
- test('it renders', async function(assert) {
-
- // Set any properties with this.set('myProperty', 'value');
- // Handle any actions with this.on('myAction', function(val) { ... });
-
- await render(hbs`{{proposal-list}}`);
-
- assert.dom('*').hasText('');
- });
-});
diff --git a/tests/unit/controllers/proposals/new-test.js b/tests/unit/controllers/proposals/new-test.js
deleted file mode 100644
index c7d2d92..0000000
--- a/tests/unit/controllers/proposals/new-test.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { module, test } from 'qunit';
-import { setupTest } from 'ember-qunit';
-
-module('Unit | Controller | proposals/new', function(hooks) {
- setupTest(hooks);
-
- // Replace this with your real tests.
- test('it exists', function(assert) {
- let controller = this.owner.lookup('controller:proposals/new');
- assert.ok(controller);
- });
-});
diff --git a/tests/unit/models/proposal-test.js b/tests/unit/models/proposal-test.js
deleted file mode 100644
index acc9659..0000000
--- a/tests/unit/models/proposal-test.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// import { moduleFor, test } from 'ember-qunit';
-//
-// moduleFor('model:proposal', 'Unit | Model | proposal');
-//
-// test('contributor relation', function(assert) {
-// // TODO: Test contributor relation
-// assert.ok(true);
-// });