diff options
author | Clement Ho <ClemMakesApps@gmail.com> | 2017-10-16 16:32:38 -0500 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2017-10-18 12:43:02 +0200 |
commit | 2b4083d3ac2e33853dacbcbd45fbf4b9f9e9c4ea (patch) | |
tree | dfbff79ec96dd1a73d78ac34e9163b5d939cca5f /app | |
parent | b0f98a2e8e7fde23666d57675f9340fa453d04a8 (diff) | |
download | gitlab-ce-2b4083d3ac2e33853dacbcbd45fbf4b9f9e9c4ea.tar.gz |
Add configurable option to display username in user avatar link component
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_link.vue | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_link.vue b/app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_link.vue index 95898d54cf7..792d8b29593 100644 --- a/app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_link.vue +++ b/app/assets/javascripts/vue_shared/components/user_avatar/user_avatar_link.vue @@ -12,12 +12,14 @@ :img-alt="tooltipText" :img-size="20" :tooltip-text="tooltipText" - tooltip-placement="top" + :tooltip-placement="top" + :username="username" /> */ import userAvatarImage from './user_avatar_image.vue'; +import tooltip from '../../directives/tooltip'; export default { name: 'UserAvatarLink', @@ -60,6 +62,22 @@ export default { required: false, default: 'top', }, + username: { + type: String, + required: false, + default: '', + }, + }, + computed: { + showUsername() { + return this.username.length > 0; + }, + avatarTooltipText() { + return this.showUsername ? '' : this.tooltipText; + }, + }, + directives: { + tooltip, }, }; </script> @@ -73,8 +91,13 @@ export default { :img-alt="imgAlt" :css-classes="imgCssClasses" :size="imgSize" - :tooltip-text="tooltipText" + :tooltip-text="avatarTooltipText" + :tooltip-placement="tooltipPlacement" + /><span + v-if="username.length > 0" + v-tooltip + :title="tooltipText" :tooltip-placement="tooltipPlacement" - /> + >{{username}}</span> </a> </template> |