diff options
Diffstat (limited to 'client/components/sidebar')
-rw-r--r-- | client/components/sidebar/sidebar.jade | 34 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.js | 41 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.styl | 22 |
3 files changed, 79 insertions, 18 deletions
diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade index f3fdd1bc..6045b371 100644 --- a/client/components/sidebar/sidebar.jade +++ b/client/components/sidebar/sidebar.jade @@ -1,16 +1,22 @@ template(name="sidebar") .board-sidebar.sidebar(class="{{#if isOpen}}is-open{{/if}}") a.sidebar-tongue.js-toggle-sidebar( - class="{{#if isTongueHidden}}is-hidden{{/if}}") + class="{{#if isTongueHidden}}is-hidden{{/if}}", + title="{{showTongueTitle}}") i.fa.fa-angle-left - .sidebar-content.js-board-sidebar-content.js-perfect-scrollbar - a.hide-btn.js-hide-sidebar - i.fa.fa-angle-right - unless isDefaultView - h2 - a.fa.fa-chevron-left.js-back-home - = getViewTitle - +Template.dynamic(template=getViewTemplate) + .sidebar-shadow + .sidebar-content.sidebar-shortcuts + a.board-header-btn.js-shortcuts + i.fa.fa-keyboard-o + span {{_ 'keyboard-shortcuts' }} + .sidebar-content.js-board-sidebar-content.js-perfect-scrollbar + a.hide-btn.js-hide-sidebar + i.fa.fa-angle-right + unless isDefaultView + h2 + a.fa.fa-chevron-left.js-back-home + = getViewTitle + +Template.dynamic(template=getViewTemplate) template(name='homeSidebar') +membersWidget @@ -54,7 +60,7 @@ template(name="labelsWidget") .board-widget-content each currentBoard.labels a.card-label(class="card-label-{{color}}" - class="{{#if currentUser.isBoardMember}}js-label{{/if}}") + class="{{#if currentUser.isNotCommentOnly}}js-label{{/if}}") span.card-label-name= name if currentUser.isBoardAdmin a.card-label.add-label.js-add-label @@ -132,9 +138,15 @@ template(name="changePermissionsPopup") li a(class="{{#if isLastAdmin}}disabled{{else}}js-set-normal{{/if}}") | {{_ 'normal'}} - unless isAdmin + if isNormal i.fa.fa-check span.sub-name {{_ 'normal-desc'}} + li + a(class="{{#if isLastAdmin}}disabled{{else}}js-set-comment-only{{/if}}") + | {{_ 'comment-only'}} + if isCommentOnly + i.fa.fa-check + span.sub-name {{_ 'comment-only-desc'}} if isLastAdmin hr p.quiet.bottom {{_ 'last-admin-desc'}} 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); diff --git a/client/components/sidebar/sidebar.styl b/client/components/sidebar/sidebar.styl index 24abe990..8f2f493e 100644 --- a/client/components/sidebar/sidebar.styl +++ b/client/components/sidebar/sidebar.styl @@ -6,11 +6,19 @@ bottom: 0 right: 0 - .sidebar-content - padding: 12px + .sidebar-shadow + position: absolute + top: 0 + bottom: 0 + right: 0 + left: 0 background: darken(white, 3%) box-shadow: -10px 0px 5px -10px darken(white, 30%) z-index: 10 + + .sidebar-content + padding: 12px + margin-bottom: 1.6em position: absolute top: 0 bottom: 0 @@ -73,6 +81,16 @@ i.fa margin-right: 10px + .sidebar-shortcuts + margin: 0 + padding: 0 + top: auto + text-align: center + font-size: 0.8em + line-height: 1.6em + vertical-align: middle + color: darken(white, 40%) + .board-sidebar width: 248px right: -@width |