diff options
author | Lauri Ojansivu <x@xet7.org> | 2020-01-03 06:49:35 +0200 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2020-01-03 06:49:35 +0200 |
commit | 2bf004120d5a43cd3c3c060fc7c0c30d1b01f220 (patch) | |
tree | a37e06277fa2ce240c06023d679c5fbef001e7a4 /client/components/sidebar/sidebar.js | |
parent | 0709b5abc84714e8c87ef27f5f0841c2a38e6d68 (diff) | |
download | wekan-2bf004120d5a43cd3c3c060fc7c0c30d1b01f220.tar.gz wekan-2bf004120d5a43cd3c3c060fc7c0c30d1b01f220.tar.bz2 wekan-2bf004120d5a43cd3c3c060fc7c0c30d1b01f220.zip |
Add Worker role.
Add more Font Awesome icons.
Fix browser console errors when editing user profile name etc.
Thanks to xet7 !
Closes #2788
Diffstat (limited to 'client/components/sidebar/sidebar.js')
-rw-r--r-- | client/components/sidebar/sidebar.js | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index caf36020..e8f38b8c 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -112,12 +112,10 @@ BlazeComponent.extendComponent({ currentUser = Meteor.user(); if (currentUser) { Meteor.call('toggleMinicardLabelText'); + } else if (cookies.has('hiddenMinicardLabelText')) { + cookies.remove('hiddenMinicardLabelText'); } else { - if (cookies.has('hiddenMinicardLabelText')) { - cookies.remove('hiddenMinicardLabelText'); - } else { - cookies.set('hiddenMinicardLabelText', 'true'); - } + cookies.set('hiddenMinicardLabelText', 'true'); } }, 'click .js-shortcuts'() { @@ -135,12 +133,10 @@ Template.homeSidebar.helpers({ currentUser = Meteor.user(); if (currentUser) { return (currentUser.profile || {}).hiddenMinicardLabelText; + } else if (cookies.has('hiddenMinicardLabelText')) { + return true; } else { - if (cookies.has('hiddenMinicardLabelText')) { - return true; - } else { - return false; - } + return false; } }, }); @@ -165,10 +161,13 @@ Template.memberPopup.helpers({ const currentBoard = Boards.findOne(Session.get('currentBoard')); const commentOnly = currentBoard.hasCommentOnly(this.userId); const noComments = currentBoard.hasNoComments(this.userId); + const worker = currentBoard.hasWorker(this.userId); if (commentOnly) { return TAPi18n.__('comment-only').toLowerCase(); } else if (noComments) { return TAPi18n.__('no-comments').toLowerCase(); + } else if (worker) { + return TAPi18n.__('worker').toLowerCase(); } else { return TAPi18n.__(type).toLowerCase(); } @@ -271,6 +270,14 @@ Template.membersWidget.helpers({ const user = Meteor.user(); return user && user.isInvitedTo(Session.get('currentBoard')); }, + isWorker() { + const user = Meteor.user(); + if (user) { + return Meteor.call(Boards.hasWorker(user.memberId)); + } else { + return false; + } + }, }); Template.membersWidget.events({ @@ -648,7 +655,7 @@ BlazeComponent.extendComponent({ }).register('addMemberPopup'); Template.changePermissionsPopup.events({ - 'click .js-set-admin, click .js-set-normal, click .js-set-no-comments, click .js-set-comment-only'( + 'click .js-set-admin, click .js-set-normal, click .js-set-no-comments, click .js-set-comment-only, click .js-set-worker'( event, ) { const currentBoard = Boards.findOne(Session.get('currentBoard')); @@ -658,11 +665,13 @@ Template.changePermissionsPopup.events({ 'js-set-comment-only', ); const isNoComments = $(event.currentTarget).hasClass('js-set-no-comments'); + const isWorker = $(event.currentTarget).hasClass('js-set-worker'); currentBoard.setMemberPermission( memberId, isAdmin, isNoComments, isCommentOnly, + isWorker, ); Popup.back(1); }, @@ -679,7 +688,8 @@ Template.changePermissionsPopup.helpers({ return ( !currentBoard.hasAdmin(this.userId) && !currentBoard.hasNoComments(this.userId) && - !currentBoard.hasCommentOnly(this.userId) + !currentBoard.hasCommentOnly(this.userId) && + !currentBoard.hasWorker(this.userId) ); }, @@ -699,6 +709,13 @@ Template.changePermissionsPopup.helpers({ ); }, + isWorker() { + const currentBoard = Boards.findOne(Session.get('currentBoard')); + return ( + !currentBoard.hasAdmin(this.userId) && currentBoard.hasWorker(this.userId) + ); + }, + isLastAdmin() { const currentBoard = Boards.findOne(Session.get('currentBoard')); return ( |