Additional vote features

This commit is contained in:
Nico 2020-04-26 02:41:26 +02:00
parent fe7398faef
commit 7bb0aa7488
5 changed files with 62 additions and 32 deletions

View file

@ -54,21 +54,7 @@ BlazeComponent.extendComponent({
}
return null;
},
votePublic() {
const card = this.currentData();
if (card.vote) return card.vote.public;
return null;
},
voteCountPositive() {
const card = this.currentData();
if (card.vote && card.vote.positive) return card.vote.positive.length;
return null;
},
voteCountNegative() {
const card = this.currentData();
if (card.vote && card.vote.negative) return card.vote.negative.length;
return null;
},
isWatching() {
const card = this.currentData();
return card.findWatcher(Meteor.userId());
@ -1001,13 +987,18 @@ BlazeComponent.extendComponent({
evt.preventDefault();
const voteQuestion = evt.target.vote.value;
const publicVote = $('#vote-public').hasClass('is-checked');
this.currentCard.setVoteQuestion(voteQuestion, publicVote);
const allowNonBoardMembers = $('#vote-allow-non-members').hasClass('is-checked');
this.currentCard.setVoteQuestion(voteQuestion, publicVote,allowNonBoardMembers);
Popup.close();
},
'click a.js-toggle-vote-public'(event) {
event.preventDefault();
$('#vote-public').toggleClass('is-checked');
},
'click a.js-toggle-vote-allow-non-members'(event) {
event.preventDefault();
$('#vote-allow-non-members').toggleClass('is-checked');
},
},
];
},