summaryrefslogtreecommitdiffstats
path: root/client/components/cards/cardDetails.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/cards/cardDetails.js')
-rw-r--r--client/components/cards/cardDetails.js46
1 files changed, 44 insertions, 2 deletions
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index 67120043..f0317e6a 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -26,6 +26,7 @@ BlazeComponent.extendComponent({
onCreated() {
this.currentBoard = Boards.findOne(Session.get('currentBoard'));
+ this.currentUser = Meteor.user();
this.isLoaded = new ReactiveVar(false);
const boardBody = this.parentComponent().parentComponent();
//in Miniview parent is Board, not BoardBody.
@@ -55,6 +56,15 @@ BlazeComponent.extendComponent({
);
},
+ canModifyCardWorker() {
+ return (
+ Meteor.user() &&
+ Meteor.user().isBoardMember() &&
+ !Meteor.user().isCommentOnly() &&
+ !Meteor.user().isWorker()
+ );
+ },
+
scrollParentContainer() {
const cardPanelWidth = 510;
const bodyBoardComponent = this.parentComponent().parentComponent();
@@ -322,7 +332,12 @@ BlazeComponent.extendComponent({
'click .js-assignee': Popup.open('cardAssignee'),
'click .js-add-assignees': Popup.open('cardAssignees'),
'click .js-add-labels': Popup.open('cardLabels'),
- 'click .js-received-date': Popup.open('editCardReceivedDate'),
+ 'click .js-received-date'(event) {
+ event.preventDefault();
+ if (!Meteor.user().isWorker) {
+ Popup.open('editCardReceivedDate');
+ }
+ },
'click .js-start-date': Popup.open('editCardStartDate'),
'click .js-due-date': Popup.open('editCardDueDate'),
'click .js-end-date': Popup.open('editCardEndDate'),
@@ -383,6 +398,13 @@ Template.cardDetails.helpers({
return user && user.isBoardAdmin() ? 'admin' : 'normal';
},
+ isWorker() {
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+ return (
+ !currentBoard.hasAdmin(this.userId) && currentBoard.hasWorker(this.userId)
+ );
+ },
+
presenceStatusClassName() {
const user = Users.findOne(this.userId);
const userPresence = presences.findOne({ userId: this.userId });
@@ -459,6 +481,15 @@ Template.cardDetailsActionsPopup.helpers({
!Meteor.user().isCommentOnly()
);
},
+
+ canModifyCardWorker() {
+ return (
+ Meteor.user() &&
+ Meteor.user().isBoardMember() &&
+ !Meteor.user().isCommentOnly() &&
+ !Meteor.user().isWorker()
+ );
+ },
});
Template.cardDetailsActionsPopup.events({
@@ -467,7 +498,12 @@ Template.cardDetailsActionsPopup.events({
'click .js-labels': Popup.open('cardLabels'),
'click .js-attachments': Popup.open('cardAttachments'),
'click .js-custom-fields': Popup.open('cardCustomFields'),
- 'click .js-received-date': Popup.open('editCardReceivedDate'),
+ 'click .js-received-date'(event) {
+ event.preventDefault();
+ if (!Meteor.user().isWorker) {
+ Popup.open('editCardReceivedDate');
+ }
+ },
'click .js-start-date': Popup.open('editCardStartDate'),
'click .js-due-date': Popup.open('editCardDueDate'),
'click .js-end-date': Popup.open('editCardEndDate'),
@@ -879,6 +915,12 @@ Template.cardAssigneesPopup.events({
card.toggleAssignee(assigneeId);
event.preventDefault();
},
+ 'click .js-select-assigneeWorker'(event) {
+ const card = Cards.findOne(Session.get('currentCard'));
+ const assigneeId = currentUser._id;
+ card.toggleAssignee(assigneeId);
+ event.preventDefault();
+ },
});
Template.cardAssigneesPopup.helpers({