adds card comment reactions feature

This commit is contained in:
Kai Lehmann 2021-08-13 20:47:55 +02:00
parent d8e8512d66
commit 2977120129
8 changed files with 239 additions and 10 deletions

View file

@ -240,6 +240,59 @@ Template.activity.helpers({
},
});
Template.commentReactions.events({
'click .reaction'(event) {
if (Meteor.user().isBoardMember()) {
const codepoint = event.currentTarget.dataset['codepoint'];
const commentId = Template.instance().data.commentId;
const cardComment = CardComments.findOne({_id: commentId});
cardComment.toggleReaction(codepoint);
}
},
'click .open-comment-reaction-popup': Popup.open('addReaction'),
})
Template.addReactionPopup.events({
'click .add-comment-reaction'(event) {
if (Meteor.user().isBoardMember()) {
const codepoint = event.currentTarget.dataset['codepoint'];
const commentId = Template.instance().data.commentId;
const cardComment = CardComments.findOne({_id: commentId});
cardComment.toggleReaction(codepoint);
}
Popup.close();
},
})
Template.addReactionPopup.helpers({
codepoints() {
return [
'👍',
'👎',
'👀',
'✅',
'❌',
'🙏',
'👏',
'🎉',
'🚀',
'😊',
'🤔',
'😔'];
}
})
Template.commentReactions.helpers({
isSelected(userIds) {
return userIds.includes(Meteor.user()._id);
},
userNames(userIds) {
return Users.find({_id: {$in: userIds}})
.map(user => user.profile.fullname)
.join(', ');
}
})
function createCardLink(card) {
if (!card) return '';
return (