diff options
author | Lauri Ojansivu <x@xet7.org> | 2017-10-09 16:38:43 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2017-10-09 16:38:43 +0300 |
commit | f16687fa9424149b1d0e616c3df574ecc6dfe90c (patch) | |
tree | 24f49d5da4609369da64860956ace72c4c4f35b3 /client/components/sidebar | |
parent | dc825823919394aee9728e92cce5dd01300905f0 (diff) | |
parent | 6ba1fc5ba1901a8cd8d7e8eb86e9ce70789d62e2 (diff) | |
download | wekan-f16687fa9424149b1d0e616c3df574ecc6dfe90c.tar.gz wekan-f16687fa9424149b1d0e616c3df574ecc6dfe90c.tar.bz2 wekan-f16687fa9424149b1d0e616c3df574ecc6dfe90c.zip |
Merge branch 'userSelfRemove' of https://github.com/amadilsons/wekan into amadilsons-userSelfRemove
Diffstat (limited to 'client/components/sidebar')
-rw-r--r-- | client/components/sidebar/sidebar.jade | 18 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.js | 16 |
2 files changed, 21 insertions, 13 deletions
diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade index 6045b371..6085c2ad 100644 --- a/client/components/sidebar/sidebar.jade +++ b/client/components/sidebar/sidebar.jade @@ -82,23 +82,27 @@ template(name="memberPopup") ul.pop-over-list li a.js-filter-member {{_ 'filter-cards'}} - if currentUser.isBoardAdmin - unless isSandstorm + unless isSandstorm + if currentUser.isBoardAdmin li a.js-change-role | {{_ 'change-permissions'}} span.quiet (#{memberType}) - li - if $eq currentUser._id userId - a.js-leave-member {{_ 'leave-board'}} - else - a.js-remove-member {{_ 'remove-from-board'}} + li + if $eq currentUser._id userId + a.js-leave-member {{_ 'leave-board'}} + else if currentUser.isBoardAdmin + a.js-remove-member {{_ 'remove-from-board'}} template(name="removeMemberPopup") p {{_ 'remove-member-pop' name=user.profile.fullname username=user.username boardTitle=board.title}} button.js-confirm.negate.full(type="submit") {{_ 'remove-member'}} +template(name="leaveBoardPopup") + p {{_ 'leave-board-pop' boardTitle=board.title}} + button.js-confirm.negate.full(type="submit") {{_ 'leave-board'}} + template(name="addMemberPopup") .js-search-member +esInput(index="users") diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index 1290fd13..f4f0c118 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -153,15 +153,13 @@ Template.memberPopup.events({ Boards.findOne(boardId).removeMember(memberId); Popup.close(); }), - 'click .js-leave-member'() { + 'click .js-leave-member': Popup.afterConfirm('leaveBoard', () => { const boardId = Session.get('currentBoard'); Meteor.call('quitBoard', boardId, (err, ret) => { - if (!ret && ret) { - Popup.close(); - FlowRouter.go('home'); - } + Popup.close(); + FlowRouter.go('home'); }); - }, + }), }); Template.removeMemberPopup.helpers({ @@ -173,6 +171,12 @@ Template.removeMemberPopup.helpers({ }, }); +Template.leaveBoardPopup.helpers({ + board() { + return Boards.findOne(Session.get('currentBoard')); + }, +}); + Template.membersWidget.helpers({ isInvited() { const user = Meteor.user(); |