diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-06-12 13:59:39 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-06-12 17:48:15 +0200 |
commit | c8945679872a0708eb67a477a99a65d508c84cb0 (patch) | |
tree | 5cf9f2cc842f891451f7bc247b5f0833c1ab39e7 /client/components/users/userAvatar.js | |
parent | 216887490e3be0ba141484afc11d37475e91562d (diff) | |
download | wekan-c8945679872a0708eb67a477a99a65d508c84cb0.tar.gz wekan-c8945679872a0708eb67a477a99a65d508c84cb0.tar.bz2 wekan-c8945679872a0708eb67a477a99a65d508c84cb0.zip |
Work on the card activities and comments
This commit also introduces a new CSSEvents object that is used to
abstract vendor specifics events related to CSS transitions and
animations.
Fixes #183.
Fixes #179.
Diffstat (limited to 'client/components/users/userAvatar.js')
-rw-r--r-- | client/components/users/userAvatar.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/client/components/users/userAvatar.js b/client/components/users/userAvatar.js index a02646c1..64975141 100644 --- a/client/components/users/userAvatar.js +++ b/client/components/users/userAvatar.js @@ -111,3 +111,40 @@ BlazeComponent.extendComponent({ }]; } }).register('changeAvatarPopup'); + +Template.cardMembersPopup.helpers({ + isCardMember: function() { + var cardId = Template.parentData()._id; + var cardMembers = Cards.findOne(cardId).members || []; + return _.contains(cardMembers, this.userId); + }, + user: function() { + return Users.findOne(this.userId); + } +}); + +Template.cardMembersPopup.events({ + 'click .js-select-member': function(evt) { + var cardId = Template.parentData(2).data._id; + var memberId = this.userId; + var operation; + if (Cards.find({ _id: cardId, members: memberId}).count() === 0) + operation = '$addToSet'; + else + operation = '$pull'; + + var query = {}; + query[operation] = { + members: memberId + }; + Cards.update(cardId, query); + evt.preventDefault(); + } +}); + +Template.cardMemberPopup.events({ + 'click .js-remove-member': function() { + Cards.update(this.cardId, {$pull: {members: this.userId}}); + Popup.close(); + } +}); |