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/lists/listHeader.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'client/components/lists/listHeader.js') diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js index c9eaee12..c7ae8e62 100644 --- a/client/components/lists/listHeader.js +++ b/client/components/lists/listHeader.js @@ -8,6 +8,11 @@ BlazeComponent.extendComponent({ } }, + isWatching() { + const list = this.currentData(); + return list.findWatcher(Meteor.userId()); + }, + events() { return [{ 'click .js-open-list-menu': Popup.open('listAction'), @@ -16,6 +21,12 @@ BlazeComponent.extendComponent({ }, }).register('listHeader'); +Template.listActionPopup.helpers({ + isWatching() { + return this.findWatcher(Meteor.userId()); + }, +}); + Template.listActionPopup.events({ 'click .js-add-card'() { const listDom = document.getElementById(`js-list-${this._id}`); @@ -29,6 +40,13 @@ Template.listActionPopup.events({ MultiSelection.add(cardIds); Popup.close(); }, + 'click .js-toggle-watch-list'() { + const currentList = this; + const level = currentList.findWatcher(Meteor.userId()) ? null : 'watching'; + Meteor.call('watch', 'list', currentList._id, level, (err, ret) => { + if (!err && ret) Popup.close(); + }); + }, 'click .js-close-list'(evt) { evt.preventDefault(); this.archive(); -- cgit v1.2.3-1-g7c22