summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2020-04-10 12:05:10 +0300
committerGitHub <noreply@github.com>2020-04-10 12:05:10 +0300
commita81921382adcab525d74f38dfdd384e50f68b50c (patch)
tree309cdc57afb23fd694a198fa1250136b3b339c3b /client
parent7566f05b97618bc9ea74964d3bb628e6c845e5df (diff)
parent8f28a409c7dd90319f785e3fc4c1b26803f67f31 (diff)
downloadwekan-a81921382adcab525d74f38dfdd384e50f68b50c.tar.gz
wekan-a81921382adcab525d74f38dfdd384e50f68b50c.tar.bz2
wekan-a81921382adcab525d74f38dfdd384e50f68b50c.zip
Merge pull request #3006 from NicoP-S/master
Public vote
Diffstat (limited to 'client')
-rw-r--r--client/components/cards/cardDetails.jade35
-rw-r--r--client/components/cards/cardDetails.js25
-rw-r--r--client/components/cards/cardDetails.styl2
3 files changed, 50 insertions, 12 deletions
diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade
index 9cd581ea..99606ae4 100644
--- a/client/components/cards/cardDetails.jade
+++ b/client/components/cards/cardDetails.jade
@@ -206,12 +206,12 @@ template(name="cardDetails")
i.fa.fa-thumbs-up
card-details-item-title {{_ 'vote-question'}}
.vote-result
- .card-label.card-label-green
- +viewer
- = voteCountPositive
- .card-label.card-label-red
- +viewer
- = voteCountNegative
+ if votePublic
+ a.card-label.card-label-green.js-show-positive-votes {{ voteCountPositive }}
+ a.card-label.card-label-red.js-show-negative-votes {{ voteCountNegative }}
+ else
+ .card-label.card-label-green {{ voteCountPositive }}
+ .card-label.card-label-red {{ voteCountNegative }}
+viewer
= getVoteQuestion
button.card-details-green.js-vote.js-vote-positive(class="{{#if voteState}}voted{{/if}}") {{_ 'vote-for-it'}}
@@ -572,6 +572,29 @@ template(name="cardStartVotingPopup")
.fields
label(for="vote") {{_ 'vote-question'}}
input.js-vote-field#vote(type="text" name="vote" value="{{card.getVoteQuestion}}" autofocus)
+ label(for="vote-public") {{_ 'vote-public'}}
+ a.js-toggle-vote-public
+ .materialCheckBox#vote-public(name="vote-public")
button.primary.confirm.js-submit {{_ 'save'}}
//- button.js-remove-color.negate.wide.right {{_ 'delete'}}
+
+template(name="positiveVoteMembersPopup")
+ ul.pop-over-list.js-card-member-list
+ each m in voteMemberPositive
+ li.item
+ a.name
+ +userAvatar(userId=m._id)
+ span.full-name
+ = m.profile.fullname
+ | (<span class="username">{{ m.username }}</span>)
+
+template(name="negativeVoteMembersPopup")
+ ul.pop-over-list.js-card-member-list
+ each m in voteMemberNegative
+ li.item
+ a.name
+ +userAvatar(userId=m._id)
+ span.full-name
+ = m.profile.fullname
+ | (<span class="username">{{ m.username }}</span>)
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index 84ba21b1..6ca5d784 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -54,6 +54,12 @@ 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;
@@ -382,6 +388,8 @@ BlazeComponent.extendComponent({
'click .js-start-date': Popup.open('editCardStartDate'),
'click .js-due-date': Popup.open('editCardDueDate'),
'click .js-end-date': Popup.open('editCardEndDate'),
+ 'click .js-show-positive-votes':Popup.open('positiveVoteMembers'),
+ 'click .js-show-negative-votes': Popup.open('negativeVoteMembers'),
'mouseenter .js-card-details'() {
const parentComponent = this.parentComponent().parentComponent();
//on mobile view parent is Board, not BoardBody.
@@ -647,7 +655,7 @@ Template.cardDetailsActionsPopup.events({
},
});
-Template.editCardTitleForm.onRendered(function() {
+Template.editCardTitleForm.onRendered(function () {
autosize(this.$('.js-edit-card-title'));
});
@@ -661,7 +669,7 @@ Template.editCardTitleForm.events({
},
});
-Template.editCardRequesterForm.onRendered(function() {
+Template.editCardRequesterForm.onRendered(function () {
autosize(this.$('.js-edit-card-requester'));
});
@@ -674,7 +682,7 @@ Template.editCardRequesterForm.events({
},
});
-Template.editCardAssignerForm.onRendered(function() {
+Template.editCardAssignerForm.onRendered(function () {
autosize(this.$('.js-edit-card-assigner'));
});
@@ -814,7 +822,7 @@ Template.copyChecklistToManyCardsPopup.events({
// copy subtasks
cursor = Cards.find({ parentId: oldId });
- cursor.forEach(function() {
+ cursor.forEach(function () {
'use strict';
const subtask = arguments[0];
subtask.parentId = _id;
@@ -963,7 +971,7 @@ BlazeComponent.extendComponent({
}
}
},
- 'click .js-delete': Popup.afterConfirm('cardDelete', function() {
+ 'click .js-delete': Popup.afterConfirm('cardDelete', function () {
Popup.close();
Cards.remove(this._id);
Utils.goBoardId(this.boardId);
@@ -1001,9 +1009,14 @@ BlazeComponent.extendComponent({
'submit .edit-vote-question'(evt) {
evt.preventDefault();
const voteQuestion = evt.target.vote.value;
- this.currentCard.setVoteQuestion(voteQuestion);
+ const publicVote = $('#vote-public').hasClass('is-checked');
+ this.currentCard.setVoteQuestion(voteQuestion, publicVote);
Popup.close();
},
+ 'click a.js-toggle-vote-public'(event) {
+ event.preventDefault();
+ $('#vote-public').toggleClass('is-checked');
+ },
},
];
},
diff --git a/client/components/cards/cardDetails.styl b/client/components/cards/cardDetails.styl
index 6b3ca91c..199a12da 100644
--- a/client/components/cards/cardDetails.styl
+++ b/client/components/cards/cardDetails.styl
@@ -338,3 +338,5 @@ card-details-color(background, color...)
justify-content: space-between
.vote-result
display: flex
+.js-show-positive-votes
+ cursor: pointer