mirror of
https://github.com/wekan/wekan.git
synced 2026-02-20 15:04:07 +01:00
(Re-)implement default avatar using user initials
We use a embedded svg to scale the initials text to its container size. The user is free to overwrite its initials in the profile form.
This commit is contained in:
parent
0b6c229b6c
commit
765b0168ea
6 changed files with 91 additions and 43 deletions
|
|
@ -31,13 +31,28 @@ Users.helpers({
|
|||
return _.where(board.members, {userId: this._id})[0].isAdmin;
|
||||
},
|
||||
|
||||
getInitials: function() {
|
||||
var profile = this.profile || {};
|
||||
if (profile.initials)
|
||||
return profile.initials;
|
||||
|
||||
else if (profile.fullname) {
|
||||
return _.reduce(profile.fullname.split(/\s+/), function(memo, word) {
|
||||
return memo + word[0];
|
||||
}, '').toUpperCase();
|
||||
|
||||
} else {
|
||||
return this.pseudo[0].toUpperCase();
|
||||
}
|
||||
},
|
||||
|
||||
toggleBoardStar: function(boardId) {
|
||||
var queryType = Meteor.user().hasStarred(boardId) ? '$pull' : '$addToSet';
|
||||
var queryType = this.hasStarred(boardId) ? '$pull' : '$addToSet';
|
||||
var query = {};
|
||||
query[queryType] = {
|
||||
'profile.starredBoards': boardId
|
||||
};
|
||||
Meteor.users.update(Meteor.userId(), query);
|
||||
Meteor.users.update(this._id, query);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue