Add an avatar for the card creator

* Add avatar to minicard
* Add field to card details
* Add show option in Board / Card Settings
This commit is contained in:
John R. Supplee 2021-04-01 23:40:07 +02:00
parent 926f39c96b
commit 5cc6a2f7d0
14 changed files with 87 additions and 9 deletions

View file

@ -1,7 +1,7 @@
template(name="commentForm")
.new-comment.js-new-comment(
class="{{#if commentFormIsOpen}}is-open{{/if}}")
+userAvatar(userId=currentUser._id)
+userAvatar(userId=currentUser._id noRemove=true)
form.js-new-comment-form
+editor(class="js-new-comment-input")
| {{getUnsavedValue 'cardComment' currentCard._id}}

View file

@ -110,9 +110,18 @@ template(name="cardDetails")
a.card-label.add-label.js-end-date
i.fa.fa-plus
hr
if currentBoard.allowsCreator
.card-details-item.card-details-item-creator
h3.card-details-item-title
i.fa.fa-user
| {{_ 'creator'}}
+userAvatar(userId=userId noRemove=true)
| {{! XXX Hack to hide syntaxic coloration /// }}
//.card-details-items
if currentBoard.allowsMembers
hr
.card-details-item.card-details-item-members
h3.card-details-item-title
i.fa.fa-users

View file

@ -356,7 +356,7 @@ BlazeComponent.extendComponent({
'click .js-go-to-linked-card'() {
Utils.goCardId(this.data().linkedId);
},
'click .js-member': Popup.open('cardMember'),
// 'click .js-member': Popup.open('cardMember'),
'click .js-add-members': Popup.open('cardMembers'),
'click .js-assignee': Popup.open('cardAssignee'),
'click .js-add-assignees': Popup.open('cardAssignees'),

View file

@ -211,6 +211,7 @@ avatar-radius = 50%
word-wrap: break-word
max-width: 36%
flex-grow: 1
&.card-details-item-creator,
&.card-details-item-received,
&.card-details-item-start,
&.card-details-item-due,

View file

@ -96,6 +96,10 @@ template(name="minicard")
each getMembers
+userAvatar(userId=this)
if showCreator
.minicard-creator
+userAvatar(userId=this.userId noRemove=true)
.badges
unless currentUser.isNoComments
if comments.count

View file

@ -21,6 +21,18 @@ BlazeComponent.extendComponent({
}).format(customFieldTrueValue);
},
showCreator() {
if (this.data().board()) {
return (
this.data().board.allowsCreator === null ||
this.data().board().allowsCreator === undefined ||
this.data().board().allowsCreator
);
// return this.data().board().allowsCreator;
}
return false;
},
events() {
return [
{

View file

@ -89,7 +89,7 @@
border-radius: 2px
margin-right: 3px
margin-bottom: 3px
.minicard-custom-fields
display:block;
.minicard-custom-field
@ -163,7 +163,8 @@
line-height: 12px
.minicard-members,
.minicard-assignees
.minicard-assignees,
.minicard-creator
float: right
margin-left: 5px
margin-bottom: 4px
@ -187,6 +188,9 @@
.minicard-assignees
border-bottom: 1px solid red
.minicard-creator
border-bottom: 1px solid green
.minicard-members:empty,
.minicard-assignees:empty
display: none

View file

@ -105,6 +105,14 @@ template(name="boardCardSettingsPopup")
span
i.fa.fa-users
| {{_ 'members'}}
div.check-div
a.flex.js-field-has-creator(class="{{#if allowsCreator}}is-checked{{/if}}")
.materialCheckBox(class="{{#if allowsCreator}}is-checked{{/if}}")
span
i.fa.fa-user
| {{_ 'creator'}}
div.check-div
a.flex.js-field-has-assignee(class="{{#if allowsAssignee}}is-checked{{/if}}")
.materialCheckBox(class="{{#if allowsAssignee}}is-checked{{/if}}")

View file

@ -730,6 +730,14 @@ BlazeComponent.extendComponent({
return this.currentBoard.allowsSubtasks;
},
allowsCreator() {
return (
this.currentBoard.allowsCreator === null ||
this.currentBoard.allowsCreator === undefined ||
this.currentBoard.allowsCreator
);
},
allowsMembers() {
return this.currentBoard.allowsMembers;
},
@ -889,6 +897,19 @@ BlazeComponent.extendComponent({
this.currentBoard.allowsSubtasks,
);
},
'click .js-field-has-creator'(evt) {
evt.preventDefault();
this.currentBoard.allowsCreator = !this.currentBoard.allowsCreator;
this.currentBoard.setAllowsCreator(this.currentBoard.allowsCreator);
$(`.js-field-has-creator ${MCB}`).toggleClass(
CKCLS,
this.currentBoard.allowsCreator,
);
$('.js-field-has-creator').toggleClass(
CKCLS,
this.currentBoard.allowsCreator,
);
},
'click .js-field-has-members'(evt) {
evt.preventDefault();
this.currentBoard.allowsMembers = !this.currentBoard.allowsMembers;

View file

@ -72,9 +72,10 @@ template(name="cardMemberPopup")
h3= user.profile.fullname
p.quiet @{{ user.username }}
ul.pop-over-list
if currentUser.isNotCommentOnly
if currentUser.isNotWorker
li: a.js-remove-member {{_ 'remove-member-from-card'}}
unless noRemove
if currentUser.isNotCommentOnly
if currentUser.isNotWorker
li: a.js-remove-member {{_ 'remove-member-from-card'}}
if $eq currentUser._id user._id
with currentUser

View file

@ -32,6 +32,7 @@ Template.userAvatar.helpers({
Template.userAvatar.events({
'click .js-change-avatar': Popup.open('changeAvatar'),
'click .js-member': Popup.open('cardMember'),
});
Template.userAvatarInitials.helpers({

View file

@ -988,5 +988,6 @@
"hide-system-messages-of-all-users": "Hide system messages of all users",
"now-system-messages-of-all-users-are-hidden": "Now system messages of all users are hidden",
"move-swimlane": "Move Swimlane",
"moveSwimlanePopup-title": "Move Swimlane"
"moveSwimlanePopup-title": "Move Swimlane",
"creator": "Creator"
}

View file

@ -372,6 +372,14 @@ Boards.attachSchema(
defaultValue: true,
},
allowsCreator: {
/**
* Does the board allow creator?
*/
type: Boolean,
defaultValue: true,
},
allowsAssignee: {
/**
* Does the board allows assignee?
@ -1187,6 +1195,10 @@ Boards.mutations({
return { $set: { allowsSubtasks } };
},
setAllowsCreator(allowsCreator) {
return { $set: { allowsCreator } };
},
setAllowsMembers(allowsMembers) {
return { $set: { allowsMembers } };
},

View file

@ -488,6 +488,7 @@ function buildProjection(query) {
modifiedAt: 1,
labelIds: 1,
customFields: 1,
userId: 1,
},
sort: {
boardId: 1,
@ -658,6 +659,9 @@ function findCards(sessionId, query) {
if (card.boardId) boards.push(card.boardId);
if (card.swimlaneId) swimlanes.push(card.swimlaneId);
if (card.listId) lists.push(card.listId);
if (card.userId) {
users.push(card.userId);
}
if (card.members) {
card.members.forEach(userId => {
users.push(userId);