diff options
Diffstat (limited to 'client/components/sidebar')
-rw-r--r-- | client/components/sidebar/sidebar.jade | 229 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.js | 415 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.styl | 2 | ||||
-rw-r--r-- | client/components/sidebar/sidebarArchives.jade | 54 | ||||
-rw-r--r-- | client/components/sidebar/sidebarArchives.js | 9 | ||||
-rw-r--r-- | client/components/sidebar/sidebarFilters.jade | 33 | ||||
-rw-r--r-- | client/components/sidebar/sidebarFilters.js | 5 |
7 files changed, 673 insertions, 74 deletions
diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade index ccfadc0c..6bfedc9c 100644 --- a/client/components/sidebar/sidebar.jade +++ b/client/components/sidebar/sidebar.jade @@ -37,11 +37,12 @@ template(name='homeSidebar') template(name="membersWidget") .board-widget.board-widget-members h3 - i.fa.fa-user + i.fa.fa-users | {{_ 'members'}} unless currentUser.isCommentOnly - a.board-header-btn.js-open-board-menu(title="{{_ 'boardMenuPopup-title'}}").right - i.board-header-btn-icon.fa.fa-cog + unless currentUser.isWorker + a.board-header-btn.js-open-board-menu(title="{{_ 'boardMenuPopup-title'}}").right + i.board-header-btn-icon.fa.fa-cog .board-widget-content each currentBoard.activeMembers @@ -71,6 +72,108 @@ template(name="boardChangeColorPopup") if isSelected i.fa.fa-check +template(name="boardCardSettingsPopup") + form.board-card-settings + h3 {{_ 'show-on-card'}} + div.check-div + a.flex.js-field-has-receiveddate(class="{{#if allowsReceivedDate}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsReceivedDate}}is-checked{{/if}}") + span + i.fa.fa-sign-out + | {{_ 'card-received'}} + div.check-div + a.flex.js-field-has-startdate(class="{{#if allowsStartDate}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsStartDate}}is-checked{{/if}}") + span + i.fa.fa-hourglass-start + | {{_ 'card-start'}} + div.check-div + a.flex.js-field-has-duedate(class="{{#if allowsDueDate}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsDueDate}}is-checked{{/if}}") + span + i.fa.fa-sign-in + | {{_ 'card-due'}} + div.check-div + a.flex.js-field-has-enddate(class="{{#if allowsEndDate}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsEndDate}}is-checked{{/if}}") + span + i.fa.fa-hourglass-end + | {{_ 'card-end'}} + div.check-div + a.flex.js-field-has-members(class="{{#if allowsMembers}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsMembers}}is-checked{{/if}}") + span + i.fa.fa-users + | {{_ 'members'}} + div.check-div + a.flex.js-field-has-assignee(class="{{#if allowsAssignee}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsAssignee}}is-checked{{/if}}") + span + i.fa.fa-user + | {{_ 'assignee'}} + div.check-div + a.flex.js-field-has-assigned-by(class="{{#if allowsAssignedBy}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsAssignedBy}}is-checked{{/if}}") + span + i.fa.fa-shopping-cart + | {{_ 'assigned-by'}} + div.check-div + a.flex.js-field-has-requested-by(class="{{#if allowsRequestedBy}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsRequestedBy}}is-checked{{/if}}") + span + i.fa.fa-user-plus + | {{_ 'requested-by'}} + div.check-div + a.flex.js-field-has-labels(class="{{#if allowsLabels}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsLabels}}is-checked{{/if}}") + span + i.fa.fa-tags + | {{_ 'labels'}} + div.check-div + a.flex.js-field-has-description-title(class="{{#if allowsDescriptionTitle}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsDescriptionTitle}}is-checked{{/if}}") + span + i.fa.fa-align-left + | {{_ 'description'}} + | {{_ 'title'}} + div.check-div + a.flex.js-field-has-description-text(class="{{#if allowsDescriptionText}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsDescriptionText}}is-checked{{/if}}") + span + i.fa.fa-align-left + | {{_ 'description'}} + | {{_ 'custom-field-text'}} + div.check-div + a.flex.js-field-has-checklists(class="{{#if allowsChecklists}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsChecklists}}is-checked{{/if}}") + span + i.fa.fa-check + | {{_ 'checklists'}} + div.check-div + a.flex.js-field-has-subtasks(class="{{#if allowsSubtasks}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsSubtasks}}is-checked{{/if}}") + span + i.fa.fa-sitemap + | {{_ 'subtasks'}} + div.check-div + a.flex.js-field-has-attachments(class="{{#if allowsAttachments}}is-checked{{/if}}") + .materialCheckBox(class="{{#if allowsAttachments}}is-checked{{/if}}") + span + i.fa.fa-paperclip + | {{_ 'attachments'}} + //div.check-div + // a.flex.js-field-has-comments(class="{{#if allowsComments}}is-checked{{/if}}") + // .materialCheckBox(class="{{#if allowsComments}}is-checked{{/if}}") + // span + // i.fa.fa-comment-o + // | {{_ 'comment'}} + //div.check-div + // a.flex.js-field-has-activities(class="{{#if allowsActivities}}is-checked{{/if}}") + // .materialCheckBox(class="{{#if allowsActivities}}is-checked{{/if}}") + // span + // i.fa.fa-history + // | {{_ 'activities'}} + template(name="boardSubtaskSettingsPopup") form.board-subtask-settings h3 {{_ 'show-parent-in-minicard'}} @@ -130,7 +233,9 @@ template(name="chooseBoardSource") template(name="archiveBoardPopup") p {{_ 'close-board-pop'}} - button.js-confirm.negate.full(type="submit") {{_ 'archive'}} + button.js-confirm.negate.full(type="submit") + i.fa.fa-archive + | {{_ 'archive'}} template(name="outgoingWebhooksPopup") each integrations @@ -140,7 +245,7 @@ template(name="outgoingWebhooksPopup") b .materialCheckBox(class="{{#unless enabled}}is-checked{{/unless}}") input.js-outgoing-webhooks-title(placeholder="{{_ 'webhook-title'}}" type="text" name="title" value=title) - input.js-outgoing-webhooks-url(type="text" name="url" value=url autofocus) + input.js-outgoing-webhooks-url(type="text" name="url" value=url) input.js-outgoing-webhooks-token(placeholder="{{_ 'webhook-token' }}" type="text" value=token name="token") select.js-outgoing-webhooks-type(name="type") each _type in types @@ -152,7 +257,7 @@ template(name="outgoingWebhooksPopup") input(type="hidden" value=_id name="id") input.primary.wide(type="submit" value="{{_ 'save'}}") form.integration-form - input.js-outgoing-webhooks-title(placeholder="{{_ 'webhook-title'}}" type="text" name="title" autofocus) + input.js-outgoing-webhooks-title(placeholder="{{_ 'webhook-title'}}" type="text" name="title") input.js-outgoing-webhooks-url(placeholder="{{_ 'URL' }}" type="text" name="url") input.js-outgoing-webhooks-token(placeholder="{{_ 'webhook-token' }}" type="text" name="token") select.js-outgoing-webhooks-type(name="type") @@ -162,38 +267,98 @@ template(name="outgoingWebhooksPopup") template(name="boardMenuPopup") ul.pop-over-list - li: a.js-custom-fields {{_ 'custom-fields'}} - li: a.js-open-archives {{_ 'archived-items'}} + li + a.js-open-rules-view(title="{{_ 'rules'}}") + i.fa.fa-magic + | {{_ 'rules'}} + li + a.js-custom-fields + i.fa.fa-list-alt + | {{_ 'custom-fields'}} + li + a.js-open-archives + i.fa.fa-archive + | {{_ 'archived-items'}} if currentUser.isBoardAdmin - li: a.js-change-board-color {{_ 'board-change-color'}} + li + a.js-change-board-color + i.fa.fa-paint-brush + | {{_ 'board-change-color'}} + //- XXX Language should be handled by sandstorm, but for now display a language selection link in the board menu. This link is normally present in the header bar that is not displayed on sandstorm. if isSandstorm - li: a.js-change-language {{_ 'language'}} + li + a.js-change-language + i.fa.fa-flag + | {{_ 'language'}} unless isSandstorm if currentUser.isBoardAdmin hr ul.pop-over-list - li: a(href="{{exportUrl}}", download="{{exportFilename}}") {{_ 'export-board'}} - unless currentBoard.isTemplatesBoard - li: a.js-archive-board {{_ 'archive-board'}} - li: a.js-outgoing-webhooks {{_ 'outgoing-webhooks'}} - hr - ul.pop-over-list - li: a.js-subtask-settings {{_ 'subtask-settings'}} + if withApi + li + a(href="{{exportUrl}}", download="{{exportFilename}}") + i.fa.fa-share-alt + | {{_ 'export-board'}} + li + a.js-outgoing-webhooks + i.fa.fa-globe + | {{_ 'outgoing-webhooks'}} + li + a.js-card-settings + i.fa.fa-id-card-o + | {{_ 'card-settings'}} + li + a.js-subtask-settings + i.fa.fa-sitemap + | {{_ 'subtask-settings'}} + unless currentBoard.isTemplatesBoard + hr + ul.pop-over-list + li + a.js-archive-board + i.fa.fa-arrow-right + i.fa.fa-archive + | {{_ 'archive-board'}} if isSandstorm hr ul.pop-over-list - li: a(href="{{exportUrl}}", download="{{exportFilename}}") {{_ 'export-board'}} - li: a.js-import-board {{_ 'import-board-c'}} - li: a.js-archive-board {{_ 'archive-board'}} - li: a.js-outgoing-webhooks {{_ 'outgoing-webhooks'}} + if withApi + li + a(href="{{exportUrl}}", download="{{exportFilename}}") + i.fa.fa-share-alt + i.fa.fa-sign-out + | {{_ 'export-board'}} + li + a.js-import-board + i.fa.fa-share-alt + i.fa.fa-sign-in + | {{_ 'import-board-c'}} + li + a.js-archive-board + i.fa.fa-arrow-right + i.fa.fa-archive + | {{_ 'archive-board'}} + li + a.js-outgoing-webhooks + i.fa.fa-globe + | {{_ 'outgoing-webhooks'}} hr ul.pop-over-list - li: a.js-subtask-settings {{_ 'subtask-settings'}} + li + a.js-card-settings + i.fa.fa-id-card-o + | {{_ 'card-settings'}} + hr + ul.pop-over-list + li + a.js-subtask-settings + i.fa.fa-sitemap + | {{_ 'subtask-settings'}} template(name="labelsWidget") .board-widget.board-widget-labels @@ -203,7 +368,7 @@ template(name="labelsWidget") .board-widget-content each currentBoard.labels a.card-label(class="card-label-{{color}}" - class="{{#if currentUser.isNotCommentOnly}}js-label{{/if}}") + class="{{#if currentUser.isNotCommentOnly}}{{#if currentUser.isNotWorker}}js-label{{/if}}{{/if}}") span.card-label-name +viewer = name @@ -232,12 +397,12 @@ template(name="memberPopup") a.js-change-role | {{_ 'change-permissions'}} span.quiet (#{memberType}) - li - if $eq currentUser._id userId - a.js-leave-member {{_ 'leave-board'}} - else if currentUser.isBoardAdmin - a.js-remove-member {{_ 'remove-from-board'}} - + unless currentUser.isWorker + 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}} @@ -301,6 +466,12 @@ template(name="changePermissionsPopup") if isCommentOnly i.fa.fa-check span.sub-name {{_ 'comment-only-desc'}} + li + a(class="{{#if isLastAdmin}}disabled{{else}}js-set-worker{{/if}}") + | {{_ 'worker'}} + if isWorker + i.fa.fa-check + span.sub-name {{_ 'worker-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 caf36020..cbe00797 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(); } @@ -183,6 +182,10 @@ Template.memberPopup.helpers({ Template.boardMenuPopup.events({ 'click .js-rename-board': Popup.open('boardChangeTitle'), + 'click .js-open-rules-view'() { + Modal.openWide('rulesMain'); + Popup.close(); + }, 'click .js-custom-fields'() { Sidebar.setView('customFields'); Popup.close(); @@ -209,9 +212,20 @@ Template.boardMenuPopup.events({ 'click .js-outgoing-webhooks': Popup.open('outgoingWebhooks'), 'click .js-import-board': Popup.open('chooseBoardSource'), 'click .js-subtask-settings': Popup.open('boardSubtaskSettings'), + 'click .js-card-settings': Popup.open('boardCardSettings'), +}); + +Template.boardMenuPopup.onCreated(function() { + this.apiEnabled = new ReactiveVar(false); + Meteor.call('_isApiEnabled', (e, result) => { + this.apiEnabled.set(result); + }); }); Template.boardMenuPopup.helpers({ + withApi() { + return Template.instance().apiEnabled.get(); + }, exportUrl() { const params = { boardId: Session.get('currentBoard'), @@ -271,6 +285,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({ @@ -465,6 +487,10 @@ BlazeComponent.extendComponent({ return this.currentBoard.allowsSubtasks; }, + allowsReceivedDate() { + return this.currentBoard.allowsReceivedDate; + }, + isBoardSelected() { return this.currentBoard.subtasksDefaultBoardId === this.currentData()._id; }, @@ -483,7 +509,7 @@ BlazeComponent.extendComponent({ 'members.userId': Meteor.userId(), }, { - sort: ['title'], + sort: { sort: 1 /* boards default sorting */ }, }, ); }, @@ -580,6 +606,359 @@ BlazeComponent.extendComponent({ BlazeComponent.extendComponent({ onCreated() { + this.currentBoard = Boards.findOne(Session.get('currentBoard')); + }, + + allowsReceivedDate() { + return this.currentBoard.allowsReceivedDate; + }, + + allowsStartDate() { + return this.currentBoard.allowsStartDate; + }, + + allowsDueDate() { + return this.currentBoard.allowsDueDate; + }, + + allowsEndDate() { + return this.currentBoard.allowsEndDate; + }, + + allowsSubtasks() { + return this.currentBoard.allowsSubtasks; + }, + + allowsMembers() { + return this.currentBoard.allowsMembers; + }, + + allowsAssignee() { + return this.currentBoard.allowsAssignee; + }, + + allowsAssignedBy() { + return this.currentBoard.allowsAssignedBy; + }, + + allowsRequestedBy() { + return this.currentBoard.allowsRequestedBy; + }, + + allowsLabels() { + return this.currentBoard.allowsLabels; + }, + + allowsChecklists() { + return this.currentBoard.allowsChecklists; + }, + + allowsAttachments() { + return this.currentBoard.allowsAttachments; + }, + + allowsComments() { + return this.currentBoard.allowsComments; + }, + + allowsDescriptionTitle() { + return this.currentBoard.allowsDescriptionTitle; + }, + + allowsDescriptionText() { + return this.currentBoard.allowsDescriptionText; + }, + + isBoardSelected() { + return this.currentBoard.dateSettingsDefaultBoardID; + }, + + isNullBoardSelected() { + return ( + this.currentBoard.dateSettingsDefaultBoardId === null || + this.currentBoard.dateSettingsDefaultBoardId === undefined + ); + }, + + boards() { + return Boards.find( + { + archived: false, + 'members.userId': Meteor.userId(), + }, + { + sort: { sort: 1 /* boards default sorting */ }, + }, + ); + }, + + lists() { + return Lists.find( + { + boardId: this.currentBoard._id, + archived: false, + }, + { + sort: ['title'], + }, + ); + }, + + hasLists() { + return this.lists().count() > 0; + }, + + isListSelected() { + return ( + this.currentBoard.dateSettingsDefaultBoardId === this.currentData()._id + ); + }, + + events() { + return [ + { + 'click .js-field-has-receiveddate'(evt) { + evt.preventDefault(); + this.currentBoard.allowsReceivedDate = !this.currentBoard + .allowsReceivedDate; + this.currentBoard.setAllowsReceivedDate( + this.currentBoard.allowsReceivedDate, + ); + $(`.js-field-has-receiveddate ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsReceivedDate, + ); + $('.js-field-has-receiveddate').toggleClass( + CKCLS, + this.currentBoard.allowsReceivedDate, + ); + }, + 'click .js-field-has-startdate'(evt) { + evt.preventDefault(); + this.currentBoard.allowsStartDate = !this.currentBoard + .allowsStartDate; + this.currentBoard.setAllowsStartDate( + this.currentBoard.allowsStartDate, + ); + $(`.js-field-has-startdate ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsStartDate, + ); + $('.js-field-has-startdate').toggleClass( + CKCLS, + this.currentBoard.allowsStartDate, + ); + }, + 'click .js-field-has-enddate'(evt) { + evt.preventDefault(); + this.currentBoard.allowsEndDate = !this.currentBoard.allowsEndDate; + this.currentBoard.setAllowsEndDate(this.currentBoard.allowsEndDate); + $(`.js-field-has-enddate ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsEndDate, + ); + $('.js-field-has-enddate').toggleClass( + CKCLS, + this.currentBoard.allowsEndDate, + ); + }, + 'click .js-field-has-duedate'(evt) { + evt.preventDefault(); + this.currentBoard.allowsDueDate = !this.currentBoard.allowsDueDate; + this.currentBoard.setAllowsDueDate(this.currentBoard.allowsDueDate); + $(`.js-field-has-duedate ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsDueDate, + ); + $('.js-field-has-duedate').toggleClass( + CKCLS, + this.currentBoard.allowsDueDate, + ); + }, + 'click .js-field-has-subtasks'(evt) { + evt.preventDefault(); + this.currentBoard.allowsSubtasks = !this.currentBoard.allowsSubtasks; + this.currentBoard.setAllowsSubtasks(this.currentBoard.allowsSubtasks); + $(`.js-field-has-subtasks ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsSubtasks, + ); + $('.js-field-has-subtasks').toggleClass( + CKCLS, + this.currentBoard.allowsSubtasks, + ); + }, + 'click .js-field-has-members'(evt) { + evt.preventDefault(); + this.currentBoard.allowsMembers = !this.currentBoard.allowsMembers; + this.currentBoard.setAllowsMembers(this.currentBoard.allowsMembers); + $(`.js-field-has-members ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsMembers, + ); + $('.js-field-has-members').toggleClass( + CKCLS, + this.currentBoard.allowsMembers, + ); + }, + 'click .js-field-has-assignee'(evt) { + evt.preventDefault(); + this.currentBoard.allowsAssignee = !this.currentBoard.allowsAssignee; + this.currentBoard.setAllowsAssignee(this.currentBoard.allowsAssignee); + $(`.js-field-has-assignee ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsAssignee, + ); + $('.js-field-has-assignee').toggleClass( + CKCLS, + this.currentBoard.allowsAssignee, + ); + }, + 'click .js-field-has-assigned-by'(evt) { + evt.preventDefault(); + this.currentBoard.allowsAssignedBy = !this.currentBoard + .allowsAssignedBy; + this.currentBoard.setAllowsAssignedBy( + this.currentBoard.allowsAssignedBy, + ); + $(`.js-field-has-assigned-by ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsAssignedBy, + ); + $('.js-field-has-assigned-by').toggleClass( + CKCLS, + this.currentBoard.allowsAssignedBy, + ); + }, + 'click .js-field-has-requested-by'(evt) { + evt.preventDefault(); + this.currentBoard.allowsRequestedBy = !this.currentBoard + .allowsRequestedBy; + this.currentBoard.setAllowsRequestedBy( + this.currentBoard.allowsRequestedBy, + ); + $(`.js-field-has-requested-by ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsRequestedBy, + ); + $('.js-field-has-requested-by').toggleClass( + CKCLS, + this.currentBoard.allowsRequestedBy, + ); + }, + 'click .js-field-has-labels'(evt) { + evt.preventDefault(); + this.currentBoard.allowsLabels = !this.currentBoard.allowsLabels; + this.currentBoard.setAllowsLabels(this.currentBoard.allowsLabels); + $(`.js-field-has-labels ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsAssignee, + ); + $('.js-field-has-labels').toggleClass( + CKCLS, + this.currentBoard.allowsLabels, + ); + }, + 'click .js-field-has-description-title'(evt) { + evt.preventDefault(); + this.currentBoard.allowsDescriptionTitle = !this.currentBoard + .allowsDescriptionTitle; + this.currentBoard.setAllowsDescriptionTitle( + this.currentBoard.allowsDescriptionTitle, + ); + $(`.js-field-has-description-title ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsDescriptionTitle, + ); + $('.js-field-has-description-title').toggleClass( + CKCLS, + this.currentBoard.allowsDescriptionTitle, + ); + }, + 'click .js-field-has-description-text'(evt) { + evt.preventDefault(); + this.currentBoard.allowsDescriptionText = !this.currentBoard + .allowsDescriptionText; + this.currentBoard.setAllowsDescriptionText( + this.currentBoard.allowsDescriptionText, + ); + $(`.js-field-has-description-text ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsDescriptionText, + ); + $('.js-field-has-description-text').toggleClass( + CKCLS, + this.currentBoard.allowsDescriptionText, + ); + }, + 'click .js-field-has-checklists'(evt) { + evt.preventDefault(); + this.currentBoard.allowsChecklists = !this.currentBoard + .allowsChecklists; + this.currentBoard.setAllowsChecklists( + this.currentBoard.allowsChecklists, + ); + $(`.js-field-has-checklists ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsChecklists, + ); + $('.js-field-has-checklists').toggleClass( + CKCLS, + this.currentBoard.allowsChecklists, + ); + }, + 'click .js-field-has-attachments'(evt) { + evt.preventDefault(); + this.currentBoard.allowsAttachments = !this.currentBoard + .allowsAttachments; + this.currentBoard.setAllowsAttachments( + this.currentBoard.allowsAttachments, + ); + $(`.js-field-has-attachments ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsAttachments, + ); + $('.js-field-has-attachments').toggleClass( + CKCLS, + this.currentBoard.allowsAttachments, + ); + }, + 'click .js-field-has-comments'(evt) { + evt.preventDefault(); + this.currentBoard.allowsComments = !this.currentBoard.allowsComments; + this.currentBoard.setAllowsComments(this.currentBoard.allowsComments); + $(`.js-field-has-comments ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsComments, + ); + $('.js-field-has-comments').toggleClass( + CKCLS, + this.currentBoard.allowsComments, + ); + }, + 'click .js-field-has-activities'(evt) { + evt.preventDefault(); + this.currentBoard.allowsActivities = !this.currentBoard + .allowsActivities; + this.currentBoard.setAllowsActivities( + this.currentBoard.allowsActivities, + ); + $(`.js-field-has-activities ${MCB}`).toggleClass( + CKCLS, + this.currentBoard.allowsActivities, + ); + $('.js-field-has-activities').toggleClass( + CKCLS, + this.currentBoard.allowsActivities, + ); + }, + }, + ]; + }, +}).register('boardCardSettingsPopup'); + +BlazeComponent.extendComponent({ + onCreated() { this.error = new ReactiveVar(''); this.loading = new ReactiveVar(false); }, @@ -648,7 +1027,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 +1037,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 +1060,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 +1081,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 ( diff --git a/client/components/sidebar/sidebar.styl b/client/components/sidebar/sidebar.styl index 740186b5..c1047277 100644 --- a/client/components/sidebar/sidebar.styl +++ b/client/components/sidebar/sidebar.styl @@ -109,7 +109,7 @@ color: darken(white, 40%) .board-sidebar - width: 248px + width: 548px right: -@width transition: top .1s, right .1s, width .1s diff --git a/client/components/sidebar/sidebarArchives.jade b/client/components/sidebar/sidebarArchives.jade index 466d2cb0..56423ad7 100644 --- a/client/components/sidebar/sidebarArchives.jade +++ b/client/components/sidebar/sidebarArchives.jade @@ -2,54 +2,60 @@ template(name="archivesSidebar") if isArchiveReady.get +basicTabs(tabs=tabs) +tabContent(slug="cards") - p.quiet - a.js-restore-all-cards {{_ 'restore-all'}} - | - - a.js-delete-all-cards {{_ 'delete-all'}} + unless isWorker + p.quiet + a.js-restore-all-cards {{_ 'restore-all'}} + | - + a.js-delete-all-cards {{_ 'delete-all'}} each archivedCards .minicard-wrapper.js-minicard +minicard(this) if currentUser.isBoardMember - p.quiet - a.js-restore-card {{_ 'restore'}} - | - - a.js-delete-card {{_ 'delete'}} + unless isWorker + p.quiet + a.js-restore-card {{_ 'restore'}} + | - + a.js-delete-card {{_ 'delete'}} if cardIsInArchivedList p.quiet.small ({{_ 'warn-list-archived'}}) else p.no-items-message {{_ 'no-archived-cards'}} +tabContent(slug="lists") - p.quiet - a.js-restore-all-lists {{_ 'restore-all'}} - | - - a.js-delete-all-lists {{_ 'delete-all'}} + unless isWorker + p.quiet + a.js-restore-all-lists {{_ 'restore-all'}} + | - + a.js-delete-all-lists {{_ 'delete-all'}} ul.archived-lists each archivedLists li.archived-lists-item = title if currentUser.isBoardMember - p.quiet - a.js-restore-list {{_ 'restore'}} - | - - a.js-delete-list {{_ 'delete'}} + unless isWorker + p.quiet + a.js-restore-list {{_ 'restore'}} + | - + a.js-delete-list {{_ 'delete'}} else li.no-items-message {{_ 'no-archived-lists'}} +tabContent(slug="swimlanes") - p.quiet - a.js-restore-all-swimlanes {{_ 'restore-all'}} - | - - a.js-delete-all-swimlanes {{_ 'delete-all'}} + unless isWorker + p.quiet + a.js-restore-all-swimlanes {{_ 'restore-all'}} + | - + a.js-delete-all-swimlanes {{_ 'delete-all'}} ul.archived-lists each archivedSwimlanes li.archived-lists-item = title if currentUser.isBoardMember - p.quiet - a.js-restore-swimlane {{_ 'restore'}} - | - - a.js-delete-swimlane {{_ 'delete'}} + unless isWorker + p.quiet + a.js-restore-swimlane {{_ 'restore'}} + | - + a.js-delete-swimlane {{_ 'delete'}} else li.no-items-message {{_ 'no-archived-swimlanes'}} else diff --git a/client/components/sidebar/sidebarArchives.js b/client/components/sidebar/sidebarArchives.js index a4846561..75b694e9 100644 --- a/client/components/sidebar/sidebarArchives.js +++ b/client/components/sidebar/sidebarArchives.js @@ -139,3 +139,12 @@ BlazeComponent.extendComponent({ ]; }, }).register('archivesSidebar'); + +Template.archivesSidebar.helpers({ + isWorker() { + const currentBoard = Boards.findOne(Session.get('currentBoard')); + return ( + !currentBoard.hasAdmin(this.userId) && currentBoard.hasWorker(this.userId) + ); + }, +}); diff --git a/client/components/sidebar/sidebarFilters.jade b/client/components/sidebar/sidebarFilters.jade index 5f929cb9..6d899b70 100644 --- a/client/components/sidebar/sidebarFilters.jade +++ b/client/components/sidebar/sidebarFilters.jade @@ -46,6 +46,24 @@ template(name="filterSidebar") i.fa.fa-check hr ul.sidebar-list + li(class="{{#if Filter.assignees.isSelected undefined}}active{{/if}}") + a.name.js-toggle-assignee-filter + span.sidebar-list-item-description + | {{_ 'filter-no-assignee'}} + if Filter.assignees.isSelected undefined + i.fa.fa-check + each currentBoard.activeMembers + with getUser userId + li(class="{{#if Filter.assignees.isSelected _id}}active{{/if}}") + a.name.js-toggle-assignee-filter + +userAvatar(userId=this._id) + span.sidebar-list-item-description + = profile.fullname + | (<span class="username">{{ username }}</span>) + if Filter.assignees.isSelected _id + i.fa.fa-check + hr + ul.sidebar-list li(class="{{#if Filter.customFields.isSelected undefined}}active{{/if}}") a.name.js-toggle-custom-fields-filter span.sidebar-list-item-description @@ -117,13 +135,14 @@ template(name="multiselectionSidebar") i.fa.fa-check else if someSelectedElementHave 'member' _id i.fa.fa-ellipsis-h - hr - a.sidebar-btn.js-move-selection - i.fa.fa-share - span {{_ 'move-selection'}} - a.sidebar-btn.js-archive-selection - i.fa.fa-archive - span {{_ 'archive-selection'}} + unless currentUser.isWorker + hr + a.sidebar-btn.js-move-selection + i.fa.fa-share + span {{_ 'move-selection'}} + a.sidebar-btn.js-archive-selection + i.fa.fa-archive + span {{_ 'archive-selection'}} template(name="disambiguateMultiLabelPopup") p {{_ 'what-to-do'}} diff --git a/client/components/sidebar/sidebarFilters.js b/client/components/sidebar/sidebarFilters.js index ee0176b9..0d402ab5 100644 --- a/client/components/sidebar/sidebarFilters.js +++ b/client/components/sidebar/sidebarFilters.js @@ -18,6 +18,11 @@ BlazeComponent.extendComponent({ Filter.members.toggle(this.currentData()._id); Filter.resetExceptions(); }, + 'click .js-toggle-assignee-filter'(evt) { + evt.preventDefault(); + Filter.assignees.toggle(this.currentData()._id); + Filter.resetExceptions(); + }, 'click .js-toggle-archive-filter'(evt) { evt.preventDefault(); Filter.archive.toggle(this.currentData()._id); |