summaryrefslogtreecommitdiffstats
path: root/client/components
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-03-28 20:55:02 +0300
committerGitHub <noreply@github.com>2017-03-28 20:55:02 +0300
commit578619d409b4952da34ac5f286c4d80a14b2015d (patch)
tree8c5aec1191ff21975569432a3496dc581f2247b4 /client/components
parent0c36f5f4c27dce6207b1d8093f387d6a55a6da02 (diff)
parente7fddc2bcb71fca3e806ac75280d5c81dfc1529e (diff)
downloadwekan-578619d409b4952da34ac5f286c4d80a14b2015d.tar.gz
wekan-578619d409b4952da34ac5f286c4d80a14b2015d.tar.bz2
wekan-578619d409b4952da34ac5f286c4d80a14b2015d.zip
Merge pull request #925 from rhelsing/comment-permissions
Comment permissions
Diffstat (limited to 'client/components')
-rw-r--r--client/components/boards/boardBody.jade2
-rw-r--r--client/components/boards/boardBody.js6
-rw-r--r--client/components/boards/boardHeader.jade4
-rw-r--r--client/components/boards/boardHeader.js6
-rw-r--r--client/components/cards/cardDate.jade12
-rw-r--r--client/components/cards/cardDate.js6
-rw-r--r--client/components/cards/cardDetails.jade45
-rw-r--r--client/components/cards/cardDetails.js8
-rw-r--r--client/components/cards/checklists.jade34
-rw-r--r--client/components/cards/checklists.js10
-rw-r--r--client/components/lists/list.js4
-rw-r--r--client/components/lists/listBody.jade2
-rw-r--r--client/components/lists/listBody.js7
-rw-r--r--client/components/lists/listHeader.jade23
-rw-r--r--client/components/sidebar/sidebar.jade10
-rw-r--r--client/components/sidebar/sidebar.js27
16 files changed, 147 insertions, 59 deletions
diff --git a/client/components/boards/boardBody.jade b/client/components/boards/boardBody.jade
index 288590da..fe10c921 100644
--- a/client/components/boards/boardBody.jade
+++ b/client/components/boards/boardBody.jade
@@ -25,7 +25,7 @@ template(name="boardBody")
+list(this)
if currentCardIsInThisList
+cardDetails(currentCard)
- if currentUser.isBoardMember
+ if canSeeAddList
+addListForm
template(name="addListForm")
diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js
index 4703bc91..370db13b 100644
--- a/client/components/boards/boardBody.js
+++ b/client/components/boards/boardBody.js
@@ -204,3 +204,9 @@ BlazeComponent.extendComponent({
}];
},
}).register('addListForm');
+
+Template.boardBody.helpers({
+ canSeeAddList() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
+});
diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade
index 599ad20a..e61aea35 100644
--- a/client/components/boards/boardHeader.jade
+++ b/client/components/boards/boardHeader.jade
@@ -65,7 +65,7 @@ template(name="boardHeaderBar")
if $eq watchLevel "muted"
i.fa.fa-bell-slash
span {{_ watchLevel}}
-
+
else
a.board-header-btn.js-log-in(
title="{{_ 'log-in'}}")
@@ -81,7 +81,7 @@ template(name="boardHeaderBar")
a.board-header-btn-close.js-filter-reset(title="{{_ 'filter-clear'}}")
i.fa.fa-times-thin
- if currentUser.isBoardMember
+ if canModifyBoard
a.board-header-btn.js-multiselection-activate(
title="{{#if MultiSelection.isActive}}{{_ 'multi-selection-on'}}{{else}}{{_ 'multi-selection'}}{{/if}}"
class="{{#if MultiSelection.isActive}}emphasis{{/if}}")
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js
index 9b03ab56..44532c3e 100644
--- a/client/components/boards/boardHeader.js
+++ b/client/components/boards/boardHeader.js
@@ -97,6 +97,12 @@ BlazeComponent.extendComponent({
},
}).register('boardHeaderBar');
+Template.boardHeaderBar.helpers({
+ canModifyBoard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
+});
+
BlazeComponent.extendComponent({
backgroundColors() {
return Boards.simpleSchema()._schema.color.allowedValues;
diff --git a/client/components/cards/cardDate.jade b/client/components/cards/cardDate.jade
index a2a28bbd..525f27ed 100644
--- a/client/components/cards/cardDate.jade
+++ b/client/components/cards/cardDate.jade
@@ -15,6 +15,12 @@ template(name="editCardDate")
button.js-delete-date.negate.wide.right.js-delete-date {{_ 'delete'}}
template(name="dateBadge")
- a.js-edit-date.card-date(title="{{showTitle}}" class="{{classes}}")
- time(datetime="{{showISODate}}")
- | {{showDate}}
+ if canModifyCard
+ a.js-edit-date.card-date(title="{{showTitle}}" class="{{classes}}")
+ time(datetime="{{showISODate}}")
+ | {{showDate}}
+ else
+ a.card-date(title="{{showTitle}}" class="{{classes}}")
+ time(datetime="{{showISODate}}")
+ | {{showDate}}
+
diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js
index 4d129e8e..3f69f384 100644
--- a/client/components/cards/cardDate.js
+++ b/client/components/cards/cardDate.js
@@ -86,6 +86,12 @@ const EditCardDate = BlazeComponent.extendComponent({
},
});
+Template.dateBadge.helpers({
+ canModifyCard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
+});
+
// editCardStartDatePopup
(class extends EditCardDate {
onCreated() {
diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade
index cf113951..9c95e92f 100644
--- a/client/components/cards/cardDetails.jade
+++ b/client/components/cards/cardDetails.jade
@@ -8,7 +8,7 @@ template(name="cardDetails")
if currentUser.isBoardMember
a.fa.fa-navicon.card-details-menu.js-open-card-details-menu
h2.card-details-title.js-card-title(
- class="{{#if currentUser.isBoardMember}}js-open-inlined-form is-editable{{/if}}")
+ class="{{#if canModifyCard}}js-open-inlined-form is-editable{{/if}}")
= title
if isWatching
i.fa.fa-eye.card-details-watch
@@ -22,16 +22,16 @@ template(name="cardDetails")
each members
+userAvatar(userId=this cardId=../_id)
| {{! XXX Hack to hide syntaxic coloration /// }}
- if currentUser.isBoardMember
+ if canModifyCard
a.member.add-member.card-details-item-add-button.js-add-members(title="{{_ 'card-members-title'}}")
i.fa.fa-plus
.card-details-item.card-details-item-labels
h3.card-details-item-title {{_ 'labels'}}
- a(class="{{#if currentUser.isBoardMember}}js-add-labels{{else}}is-disabled{{/if}}" title="{{_ 'card-labels-title'}}")
+ a(class="{{#if canModifyCard}}js-add-labels{{else}}is-disabled{{/if}}" title="{{_ 'card-labels-title'}}")
each labels
span.card-label(class="card-label-{{color}}" title=name)= name
- if currentUser.isBoardMember
+ if canModifyCard
a.card-label.add-label.js-add-labels(title="{{_ 'card-labels-title'}}")
i.fa.fa-plus
@@ -47,7 +47,7 @@ template(name="cardDetails")
//- XXX We should use "editable" to avoid repetiting ourselves
- if currentUser.isBoardMember
+ if canModifyCard
h3.card-details-item-title {{_ 'description'}}
+inlinedCardDescription(classNames="card-description js-card-description")
+editor(autofocus=true)
@@ -101,23 +101,24 @@ template(name="editCardTitleForm")
template(name="cardDetailsActionsPopup")
ul.pop-over-list
li: a.js-toggle-watch-card {{#if isWatching}}{{_ 'unwatch'}}{{else}}{{_ 'watch'}}{{/if}}
- hr
- ul.pop-over-list
- li: a.js-members {{_ 'card-edit-members'}}
- li: a.js-labels {{_ 'card-edit-labels'}}
- li: a.js-attachments {{_ 'card-edit-attachments'}}
- li: a.js-start-date {{_ 'editCardStartDatePopup-title'}}
- li: a.js-due-date {{_ 'editCardDueDatePopup-title'}}
- hr
- ul.pop-over-list
- li: a.js-move-card-to-top {{_ 'moveCardToTop-title'}}
- li: a.js-move-card-to-bottom {{_ 'moveCardToBottom-title'}}
- hr
- ul.pop-over-list
- li: a.js-move-card {{_ 'moveCardPopup-title'}}
- unless archived
- li: a.js-archive {{_ 'archive-card'}}
- li: a.js-more {{_ 'cardMorePopup-title'}}
+ if canModifyCard
+ hr
+ ul.pop-over-list
+ li: a.js-members {{_ 'card-edit-members'}}
+ li: a.js-labels {{_ 'card-edit-labels'}}
+ li: a.js-attachments {{_ 'card-edit-attachments'}}
+ li: a.js-start-date {{_ 'editCardStartDatePopup-title'}}
+ li: a.js-due-date {{_ 'editCardDueDatePopup-title'}}
+ hr
+ ul.pop-over-list
+ li: a.js-move-card-to-top {{_ 'moveCardToTop-title'}}
+ li: a.js-move-card-to-bottom {{_ 'moveCardToBottom-title'}}
+ hr
+ ul.pop-over-list
+ li: a.js-move-card {{_ 'moveCardPopup-title'}}
+ unless archived
+ li: a.js-archive {{_ 'archive-card'}}
+ li: a.js-more {{_ 'cardMorePopup-title'}}
template(name="moveCardPopup")
+boardLists
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index b7e0ef76..b39f8e59 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -28,6 +28,10 @@ BlazeComponent.extendComponent({
return card.findWatcher(Meteor.userId());
},
+ canModifyCard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
+
scrollParentContainer() {
const cardPanelWidth = 510;
const bodyBoardComponent = this.parentComponent();
@@ -140,6 +144,10 @@ Template.cardDetailsActionsPopup.helpers({
isWatching() {
return this.findWatcher(Meteor.userId());
},
+
+ canModifyCard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
});
Template.cardDetailsActionsPopup.events({
diff --git a/client/components/cards/checklists.jade b/client/components/cards/checklists.jade
index 987e6cd9..a0d89351 100644
--- a/client/components/cards/checklists.jade
+++ b/client/components/cards/checklists.jade
@@ -3,12 +3,13 @@ template(name="checklists")
.card-checklist-items
each checklist in currentCard.checklists
+checklistDetail(checklist = checklist)
- +inlinedForm(classNames="js-add-checklist" cardId = cardId)
- +addChecklistItemForm
- else
- a.js-open-inlined-form
- i.fa.fa-plus
- | {{_ 'add-checklist'}}...
+ if canModifyCard
+ +inlinedForm(classNames="js-add-checklist" cardId = cardId)
+ +addChecklistItemForm
+ else
+ a.js-open-inlined-form
+ i.fa.fa-plus
+ | {{_ 'add-checklist'}}...
template(name="checklistDetail")
+inlinedForm(classNames="js-edit-checklist-title" checklist = checklist)
@@ -16,9 +17,13 @@ template(name="checklistDetail")
else
.checklist-title
.checkbox.fa.fa-check-square-o
- a.js-delete-checklist {{_ "delete"}}...
+ if canModifyCard
+ a.js-delete-checklist {{_ "delete"}}...
span.checklist-stat(class="{{#if checklist.isFinished}}is-finished{{/if}}") {{checklist.finishedCount}}/{{checklist.itemCount}}
- h2.title.js-open-inlined-form.is-editable {{checklist.title}}
+ if canModifyCard
+ h2.title.js-open-inlined-form.is-editable {{checklist.title}}
+ else
+ h2.title {{checklist.title}}
+checklistItems(checklist = checklist)
template(name="addChecklistItemForm")
@@ -37,7 +42,7 @@ template(name="editChecklistItemForm")
button.primary.confirm.js-submit-edit-checklist-item-form(type="submit") {{_ 'save'}}
a.fa.fa-times-thin.js-close-inlined-form
span(title=createdAt) {{ moment createdAt }}
- if currentUser.isBoardMember
+ if canModifyCard
a.js-delete-checklist-item {{_ "delete"}}...
template(name="checklistItems")
@@ -47,7 +52,7 @@ template(name="checklistItems")
+editChecklistItemForm(type = 'item' item = item checklist = checklist)
else
+itemDetail(item = item checklist = checklist)
- if currentUser.isBoardMember
+ if canModifyCard
+inlinedForm(classNames="js-add-checklist-item" checklist = checklist)
+addChecklistItemForm
else
@@ -57,5 +62,10 @@ template(name="checklistItems")
template(name='itemDetail')
.item
- .check-box.materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}")
- .item-title.js-open-inlined-form.is-editable(class="{{#if item.isFinished }}is-checked{{/if}}") {{item.title}}
+ if canModifyCard
+ .check-box.materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}")
+ .item-title.js-open-inlined-form.is-editable(class="{{#if item.isFinished }}is-checked{{/if}}") {{item.title}}
+ else
+ .materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}")
+ .item-title(class="{{#if item.isFinished }}is-checked{{/if}}") {{item.title}}
+
diff --git a/client/components/cards/checklists.js b/client/components/cards/checklists.js
index 5dac7bd3..b8f5e443 100644
--- a/client/components/cards/checklists.js
+++ b/client/components/cards/checklists.js
@@ -26,6 +26,10 @@ BlazeComponent.extendComponent({
checklist.setTitle(title);
},
+ canModifyCard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
+
editChecklistItem(event) {
event.preventDefault();
@@ -73,6 +77,12 @@ BlazeComponent.extendComponent({
},
}).register('checklists');
+Template.itemDetail.helpers({
+ canModifyCard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
+});
+
BlazeComponent.extendComponent({
toggleItem() {
const checklist = this.currentData().checklist;
diff --git a/client/components/lists/list.js b/client/components/lists/list.js
index 187d8ec3..9c191348 100644
--- a/client/components/lists/list.js
+++ b/client/components/lists/list.js
@@ -79,10 +79,10 @@ BlazeComponent.extendComponent({
});
function userIsMember() {
- return Meteor.user() && Meteor.user().isBoardMember();
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
}
- // Disable drag-dropping if the current user is not a board member
+ // Disable drag-dropping if the current user is not a board member or is comment only
this.autorun(() => {
$cards.sortable('option', 'disabled', !userIsMember());
});
diff --git a/client/components/lists/listBody.jade b/client/components/lists/listBody.jade
index e659b179..01aa7179 100644
--- a/client/components/lists/listBody.jade
+++ b/client/components/lists/listBody.jade
@@ -12,7 +12,7 @@ template(name="listBody")
.materialCheckBox.multi-selection-checkbox.js-toggle-multi-selection(
class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}")
+minicard(this)
- if currentUser.isBoardMember
+ if canSeeAddCard
+inlinedForm(autoclose=false position="bottom")
+addCardForm(listId=_id position="bottom")
else
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js
index 34c2dcd6..bdc812c7 100644
--- a/client/components/lists/listBody.js
+++ b/client/components/lists/listBody.js
@@ -239,3 +239,10 @@ BlazeComponent.extendComponent({
});
},
}).register('addCardForm');
+
+
+Template.listBody.helpers({
+ canSeeAddCard() {
+ return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
+ },
+});
diff --git a/client/components/lists/listHeader.jade b/client/components/lists/listHeader.jade
index 29aa4282..3f6ce0eb 100644
--- a/client/components/lists/listHeader.jade
+++ b/client/components/lists/listHeader.jade
@@ -25,17 +25,18 @@ template(name="editListTitleForm")
template(name="listActionPopup")
ul.pop-over-list
li: a.js-toggle-watch-list {{#if isWatching}}{{_ 'unwatch'}}{{else}}{{_ 'watch'}}{{/if}}
- hr
- ul.pop-over-list
- li: a.js-add-card {{_ 'add-card'}}
- if cards.count
- li: a.js-select-cards {{_ 'list-select-cards'}}
- hr
- ul.pop-over-list
- li: a.js-close-list {{_ 'archive-list'}}
- hr
- ul.pop-over-list
- li: a.js-remove-list {{_ 'remove-list'}}
+ unless currentUser.isCommentOnly
+ hr
+ ul.pop-over-list
+ li: a.js-add-card {{_ 'add-card'}}
+ if cards.count
+ li: a.js-select-cards {{_ 'list-select-cards'}}
+ hr
+ ul.pop-over-list
+ li: a.js-close-list {{_ 'archive-list'}}
+ hr
+ ul.pop-over-list
+ li: a.js-remove-list {{_ 'remove-list'}}
template(name="boardLists")
ul.pop-over-list
diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade
index 8e1fecaa..6045b371 100644
--- a/client/components/sidebar/sidebar.jade
+++ b/client/components/sidebar/sidebar.jade
@@ -60,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
@@ -138,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 f649b4ad..1290fd13 100644
--- a/client/components/sidebar/sidebar.js
+++ b/client/components/sidebar/sidebar.js
@@ -121,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'));
@@ -308,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);
},
});
@@ -323,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);