From 9bbdacc79a89667e0d6f1ed30c415e5350ad468b Mon Sep 17 00:00:00 2001 From: Liming Xie Date: Tue, 5 Jan 2016 23:26:02 +0800 Subject: Add notification, allow watch boards / lists / cards --- client/components/cards/cardDetails.jade | 5 +++++ client/components/cards/cardDetails.js | 18 ++++++++++++++++++ client/components/cards/cardDetails.styl | 5 +++++ 3 files changed, 28 insertions(+) (limited to 'client/components/cards') diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 3f2ae34a..2ca032ef 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -10,6 +10,8 @@ template(name="cardDetails") h2.card-details-title.js-card-title( class="{{#if currentUser.isBoardMember}}js-open-inlined-form is-editable{{/if}}") = title + if isWatching + i.fa.fa-eye.card-details-watch if archived p.warning {{_ 'card-archived'}} @@ -82,6 +84,9 @@ template(name="editCardTitleForm") a.fa.fa-times-thin.js-close-inlined-form template(name="cardDetailsActionsPopup") + ul.pop-over-list + li: a.js-toggle-watch-card {{#if isWatching}}{{_ 'unwatch'}}{{else}}{{_ 'watch'}}{{/if}} + hr ul.pop-over-list li: a.js-members {{_ 'card-edit-members'}} li: a.js-labels {{_ 'card-edit-labels'}} diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 2b04adad..d8323393 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -23,6 +23,11 @@ BlazeComponent.extendComponent({ this.calculateNextPeak(); }, + isWatching() { + const card = this.currentData(); + return card.findWatcher(Meteor.userId()); + }, + scrollParentContainer() { const cardPanelWidth = 510; const bodyBoardComponent = this.parentComponent(); @@ -128,6 +133,12 @@ BlazeComponent.extendComponent({ } }).register('inlinedCardDescription'); +Template.cardDetailsActionsPopup.helpers({ + isWatching() { + return this.findWatcher(Meteor.userId()); + }, +}); + Template.cardDetailsActionsPopup.events({ 'click .js-members': Popup.open('cardMembers'), 'click .js-labels': Popup.open('cardLabels'), @@ -139,6 +150,13 @@ Template.cardDetailsActionsPopup.events({ Popup.close(); }, 'click .js-more': Popup.open('cardMore'), + 'click .js-toggle-watch-card'() { + const currentCard = this; + const level = currentCard.findWatcher(Meteor.userId()) ? null : 'watching'; + Meteor.call('watch', 'card', currentCard._id, level, (err, ret) => { + if (!err && ret) Popup.close(); + }); + }, }); Template.editCardTitleForm.onRendered(function() { diff --git a/client/components/cards/cardDetails.styl b/client/components/cards/cardDetails.styl index 4ac0578b..d7d29551 100644 --- a/client/components/cards/cardDetails.styl +++ b/client/components/cards/cardDetails.styl @@ -36,6 +36,11 @@ font-size: 17px padding: 10px + .card-details-watch + font-size: 17px + padding-left: 7px + color: #a6a6a6 + .card-details-title font-weight: bold font-size: 1.33em -- cgit v1.2.3-1-g7c22