debian-mirror-gitlab/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_author.vue

46 lines
905 B
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2018-12-13 13:39:08 +05:30
import tooltip from '../../vue_shared/directives/tooltip';
2018-03-17 18:26:18 +05:30
2018-12-13 13:39:08 +05:30
export default {
name: 'MrWidgetAuthor',
directives: {
tooltip,
},
props: {
author: {
type: Object,
required: true,
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
showAuthorName: {
type: Boolean,
required: false,
default: true,
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
showAuthorTooltip: {
type: Boolean,
required: false,
default: false,
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
},
computed: {
authorUrl() {
return this.author.webUrl || this.author.web_url;
},
avatarUrl() {
return this.author.avatarUrl || this.author.avatar_url;
},
},
};
2018-03-17 18:26:18 +05:30
</script>
<template>
<a
:href="authorUrl"
:v-tooltip="showAuthorTooltip"
:title="author.name"
2018-11-08 19:23:39 +05:30
class="author-link inline"
2018-03-17 18:26:18 +05:30
>
2019-02-15 15:39:39 +05:30
<img :src="avatarUrl" class="avatar avatar-inline s16" />
<span v-if="showAuthorName" class="author"> {{ author.name }} </span>
2018-03-17 18:26:18 +05:30
</a>
</template>