Reset selectedProposals after confirmation
This commit is contained in:
@@ -12,6 +12,13 @@ export default Component.extend({
|
||||
submitButtonDisabled: empty('selectedProposals'),
|
||||
|
||||
actions: {
|
||||
confirm() {
|
||||
this.confirmProposals(this.selectedProposals)
|
||||
.then(() => {
|
||||
this.selectedProposals = [];
|
||||
});
|
||||
},
|
||||
|
||||
toggleSelect(proposalId, selected) {
|
||||
if (selected) {
|
||||
this.selectedProposals.removeObject(proposalId);
|
||||
|
||||
@@ -8,10 +8,7 @@
|
||||
|
||||
{{#if confirmProposals}}
|
||||
<center>
|
||||
<button
|
||||
disabled={{submitButtonDisabled}}
|
||||
{{action confirmProposals selectedProposals}}
|
||||
>
|
||||
<button disabled={{submitButtonDisabled}} {{action 'confirm'}}>
|
||||
Submit selected
|
||||
</button>
|
||||
</center>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Controller from '@ember/controller';
|
||||
import { alias, filter, filterBy, sort } from '@ember/object/computed';
|
||||
import { inject as injectService } from '@ember/service';
|
||||
import RSVP from 'rsvp';
|
||||
|
||||
export default Controller.extend({
|
||||
kredits: injectService(),
|
||||
@@ -22,12 +23,14 @@ export default Controller.extend({
|
||||
actions: {
|
||||
confirmProposals(proposalIds) {
|
||||
if (this.kredits.currentUser.isCore) {
|
||||
this.kredits.batchVote(proposalIds)
|
||||
return this.kredits.batchVote(proposalIds)
|
||||
.then((transaction) => {
|
||||
window.confirm('Vote submitted to Ethereum blockhain: '+transaction.hash);
|
||||
return transaction;
|
||||
});
|
||||
} else {
|
||||
window.alert('Only members can vote on proposals. Please ask someone to set you up.');
|
||||
return RSVP.reject();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user