diff options
Diffstat (limited to 'client/components/sidebar/sidebar.js')
-rw-r--r-- | client/components/sidebar/sidebar.js | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index f32a27c5..1290fd13 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -89,11 +89,21 @@ BlazeComponent.extendComponent({ return TAPi18n.__(viewTitles[this.getView()]); }, + showTongueTitle() { + if (this.isOpen()) + return `${TAPi18n.__('sidebar-close')}`; + else + return `${TAPi18n.__('sidebar-open')}`; + }, + events() { return [{ 'click .js-hide-sidebar': this.hide, 'click .js-toggle-sidebar': this.toggle, 'click .js-back-home': this.setView, + 'click .js-shortcuts'() { + FlowRouter.go('shortcuts'); + }, }]; }, }).register('sidebar'); @@ -111,7 +121,17 @@ Template.memberPopup.helpers({ }, memberType() { const type = Users.findOne(this.userId).isBoardAdmin() ? 'admin' : 'normal'; - return TAPi18n.__(type).toLowerCase(); + if(type === 'normal'){ + const currentBoard = Boards.findOne(Session.get('currentBoard')); + const commentOnly = currentBoard.hasCommentOnly(this.userId); + if(commentOnly){ + return TAPi18n.__('comment-only').toLowerCase(); + } else { + return TAPi18n.__(type).toLowerCase(); + } + } else { + return TAPi18n.__(type).toLowerCase(); + } }, isInvited() { return Users.findOne(this.userId).isInvitedTo(Session.get('currentBoard')); @@ -134,8 +154,8 @@ Template.memberPopup.events({ Popup.close(); }), 'click .js-leave-member'() { - const currentBoard = Boards.findOne(Session.get('currentBoard')); - Meteor.call('quitBoard', currentBoard, (err, ret) => { + const boardId = Session.get('currentBoard'); + Meteor.call('quitBoard', boardId, (err, ret) => { if (!ret && ret) { Popup.close(); FlowRouter.go('home'); @@ -298,11 +318,12 @@ BlazeComponent.extendComponent({ }).register('addMemberPopup'); Template.changePermissionsPopup.events({ - 'click .js-set-admin, click .js-set-normal'(event) { + 'click .js-set-admin, click .js-set-normal, click .js-set-comment-only'(event) { const currentBoard = Boards.findOne(Session.get('currentBoard')); const memberId = this.userId; const isAdmin = $(event.currentTarget).hasClass('js-set-admin'); - currentBoard.setMemberPermission(memberId, isAdmin); + const isCommentOnly = $(event.currentTarget).hasClass('js-set-comment-only'); + currentBoard.setMemberPermission(memberId, isAdmin, isCommentOnly); Popup.back(1); }, }); @@ -313,6 +334,16 @@ Template.changePermissionsPopup.helpers({ return currentBoard.hasAdmin(this.userId); }, + isNormal() { + const currentBoard = Boards.findOne(Session.get('currentBoard')); + return !currentBoard.hasAdmin(this.userId) && !currentBoard.hasCommentOnly(this.userId); + }, + + isCommentOnly() { + const currentBoard = Boards.findOne(Session.get('currentBoard')); + return !currentBoard.hasAdmin(this.userId) && currentBoard.hasCommentOnly(this.userId); + }, + isLastAdmin() { const currentBoard = Boards.findOne(Session.get('currentBoard')); return currentBoard.hasAdmin(this.userId) && (currentBoard.activeAdmins() === 1); |