diff options
Diffstat (limited to 'client/components/lists/listHeader.js')
-rw-r--r-- | client/components/lists/listHeader.js | 18 |
1 files changed, 18 insertions, 0 deletions
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(); |