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/boards/boardHeader.jade | 49 +++++++++++++++++++++++++++++++ client/components/boards/boardHeader.js | 28 ++++++++++++++++++ 2 files changed, 77 insertions(+) (limited to 'client/components/boards') diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade index fe6b56e6..ce8999c3 100644 --- a/client/components/boards/boardHeader.jade +++ b/client/components/boards/boardHeader.jade @@ -19,6 +19,17 @@ template(name="boardHeaderBar") i.fa(class="{{#if currentBoard.isPublic}}fa-globe{{else}}fa-lock{{/if}}") span {{_ currentBoard.permission}} + a.board-header-btn.js-watch-board + if $eq watchLevel "watching" + i.fa.fa-eye + span {{_ 'watching'}} + if $eq watchLevel "tracking" + i.fa.fa-user + span {{_ 'tracking'}} + if $eq watchLevel "muted" + i.fa.fa-times-circle + span {{_ 'muted'}} + .board-header-btns.right if isMiniScreen unless isSandstorm @@ -34,6 +45,17 @@ template(name="boardHeaderBar") i.fa(class="{{#if currentBoard.isPublic}}fa-globe{{else}}fa-lock{{/if}}") span {{_ currentBoard.permission}} + a.board-header-btn.js-watch-board + if $eq watchLevel "watching" + i.fa.fa-eye + span {{_ 'watching'}} + if $eq watchLevel "tracking" + i.fa.fa-user + span {{_ 'tracking'}} + if $eq watchLevel "muted" + i.fa.fa-times-circle + span {{_ 'muted'}} + a.board-header-btn.js-open-filter-view( title="{{#if Filter.isActive}}{{_ 'filter-on-desc'}}{{/if}}" class="{{#if Filter.isActive}}emphasis{{/if}}") @@ -97,6 +119,33 @@ template(name="boardVisibilityList") template(name="boardChangeVisibilityPopup") +boardVisibilityList +template(name="boardChangeWatchPopup") + ul.pop-over-list + li + with "watching" + a.js-select-watch + i.fa.fa-eye.colorful + | {{_ 'watching'}} + if watchCheck + i.fa.fa-check + span.sub-name {{_ 'watching-info'}} + li + with "tracking" + a.js-select-watch + i.fa.fa-user.colorful + | {{_ 'tracking'}} + if watchCheck + i.fa.fa-check + span.sub-name {{_ 'tracking-info'}} + li + with "muted" + a.js-select-watch + i.fa.fa-times-circle.colorful + | {{_ 'muted'}} + if watchCheck + i.fa.fa-check + span.sub-name {{_ 'muted-info'}} + template(name="boardChangeColorPopup") .board-backgrounds-list.clearfix each backgroundColors diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index acf40f44..567f14ac 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -41,6 +41,11 @@ Template.boardChangeTitlePopup.events({ }); BlazeComponent.extendComponent({ + watchLevel() { + const currentBoard = Boards.findOne(Session.get('currentBoard')); + return currentBoard.getWatchLevel(Meteor.userId()); + }, + isStarred() { const boardId = Session.get('currentBoard'); const user = Meteor.user(); @@ -65,6 +70,7 @@ BlazeComponent.extendComponent({ }, 'click .js-open-board-menu': Popup.open('boardMenu'), 'click .js-change-visibility': Popup.open('boardChangeVisibility'), + 'click .js-watch-board': Popup.open('boardChangeWatch'), 'click .js-open-filter-view'() { Sidebar.setView('filter'); }, @@ -176,3 +182,25 @@ BlazeComponent.extendComponent({ }]; }, }).register('boardChangeVisibilityPopup'); + +BlazeComponent.extendComponent({ + watchLevel() { + const currentBoard = Boards.findOne(Session.get('currentBoard')); + return currentBoard.getWatchLevel(Meteor.userId()); + }, + + watchCheck() { + return this.currentData() === this.watchLevel(); + }, + + events() { + return [{ + 'click .js-select-watch'() { + const level = this.currentData(); + Meteor.call('watch', 'board', Session.get('currentBoard'), level, (err, ret) => { + if (!err && ret) Popup.close(); + }); + }, + }]; + }, +}).register('boardChangeWatchPopup'); -- cgit v1.2.3-1-g7c22