Add Worker role.

Add more Font Awesome icons.
Fix browser console errors when editing user profile name etc.

Thanks to xet7 !

Closes #2788
This commit is contained in:
Lauri Ojansivu 2020-01-03 06:49:35 +02:00
parent 0709b5abc8
commit 2bf004120d
37 changed files with 683 additions and 320 deletions

View file

@ -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({