This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 8d46789248898ef45781b5cd2c293070ef45e706 Author: Kevin Morin <morin@codelutin.com> Date: Thu Aug 3 18:07:33 2017 +0200 fixes #109 Letter avatar avec un seul lettre --- .../src/main/web/tag/components/LetterAvatar.tag.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/components/LetterAvatar.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/LetterAvatar.tag.html index ffb5efc8..e6d0df88 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/LetterAvatar.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/LetterAvatar.tag.html @@ -11,9 +11,14 @@ if (this.opts.name.trim().length > 0) { let nameSplit = this.opts.name.split(); this.avatarLetter = nameSplit[0][0].toUpperCase(); - let secondLetter = (nameSplit.length > 1 ? nameSplit[1][0] : nameSplit[0][1]).toUpperCase(); + let secondLetter = null; + if (nameSplit.length > 1) { + secondLetter = nameSplit[1][0].toUpperCase(); + } else if (nameSplit[0].length > 1) { + secondLetter = nameSplit[0][1].toUpperCase(); + } let letterIndex = this.avatarLetter.charCodeAt() - 64; - let secondIndex = secondLetter.charCodeAt() - 64; + let secondIndex = secondLetter ? secondLetter.charCodeAt() - 64 : 0; let hue = (360 / (26 * 26)) * (secondIndex * 26 + letterIndex); this.backgroundColor = "hsl(" + hue + ", 68%, 48%)"; } else { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.