diff options
Diffstat (limited to 'client/components/sidebar')
-rw-r--r-- | client/components/sidebar/sidebar.jade | 22 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.js | 13 |
2 files changed, 20 insertions, 15 deletions
diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade index f162fd6c..7e9cde80 100644 --- a/client/components/sidebar/sidebar.jade +++ b/client/components/sidebar/sidebar.jade @@ -26,7 +26,7 @@ template(name="membersWidget") i.fa.fa-user | {{_ 'members'}} .board-widget-content - each currentBoard.members + each currentBoard.activeMembers +userAvatar(userId=this.userId showStatus=true) unless isSandstorm if currentUser.isBoardAdmin @@ -50,7 +50,7 @@ template(name="labelsWidget") template(name="memberPopup") .board-member-menu .miniprofile-header - +userAvatar(userId=user._id) + +userAvatar(userId=user._id showEdit=true) .info h3 .js-profile= user.profile.fullname @@ -67,10 +67,12 @@ template(name="memberPopup") | {{_ 'change-permissions'}} span.quiet (#{memberType}) li - if currentUser.isBoardAdmin - a.js-remove-member {{_ 'remove-from-board'}} + if $eq currentUser._id userId + //- + XXX Not implemented! + // a.js-leave-member {{_ 'leave-board'}} else - a.js-leave-member {{_ 'leave-board'}} + a.js-remove-member {{_ 'remove-from-board'}} template(name="removeMemberPopup") @@ -81,16 +83,16 @@ template(name="addMemberPopup") .js-search-member +esInput(index="users") - ul.pop-over-member-list + ul.pop-over-list +esEach(index="users") - li.item.js-member-item(class="{{#if isBoardMember }}disabled{{/if}}") - a.name.js-select-member(title="{{ profile.name }} ({{ username }})") + li.item.js-member-item(class="{{#if isBoardMember}}disabled{{/if}}") + a.name.js-select-member(title="{{profile.name}} ({{username}})") +userAvatar(userId=_id) span.full-name = profile.name - | (<span class="username">{{ username }}</span>) + | (<span class="username">{{username}}</span>) if isBoardMember - .extra-text.quiet ({{_ 'joined'}}) + .quiet ({{_ 'joined'}}) +ifEsIsSearching(index='users') +spinner diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index 51f3e0e4..ccc7e5aa 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -206,7 +206,7 @@ Template.addMemberPopup.helpers({ }); Template.addMemberPopup.events({ - 'click .pop-over-member-list li:not(.disabled)'() { + 'click .js-select-member'() { const userId = this._id; const currentBoard = Boards.findOne(Session.get('currentBoard')); const currentMembersIds = _.pluck(currentBoard.members, 'userId'); @@ -233,14 +233,14 @@ Template.addMemberPopup.events({ }, }); -Template.addMemberPopup.onRendered(() => { +Template.addMemberPopup.onRendered(function() { this.find('.js-search-member input').focus(); }); Template.changePermissionsPopup.events({ 'click .js-set-admin, click .js-set-normal'(event) { const currentBoard = Boards.findOne(Session.get('currentBoard')); - const memberIndex = getMemberIndex(currentBoard, this.user._id); + const memberIndex = getMemberIndex(currentBoard, this.userId); const isAdmin = $(event.currentTarget).hasClass('js-set-admin'); Boards.update(currentBoard._id, { @@ -254,10 +254,13 @@ Template.changePermissionsPopup.events({ Template.changePermissionsPopup.helpers({ isAdmin() { - return this.user.isBoardAdmin(); + const user = Users.findOne(this.userId); + return user.isBoardAdmin(); }, + isLastAdmin() { - if (!this.user.isBoardAdmin()) + const user = Users.findOne(this.userId); + if (!user.isBoardAdmin()) return false; const currentBoard = Boards.findOne(Session.get('currentBoard')); const nbAdmins = _.where(currentBoard.members, { isAdmin: true }).length; |