Skip to content
Snippets Groups Projects

Consolidate user avatar Vue logic

Merged username-removed-408230 requested to merge user-avatar-vue-ce into master
All threads resolved!
12 files
+ 98
82
Compare changes
  • Side-by-side
  • Inline
Files
12
import Vue from 'vue';
import eventHub from '../eventhub';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link';
const Store = gl.issueBoards.BoardsStore;
@@ -31,6 +32,9 @@ gl.issueBoards.IssueCardInner = Vue.extend({
default: false,
},
},
components: {
'user-avatar-link': UserAvatarLink,
},
computed: {
cardUrl() {
return `${this.issueLinkBase}/${this.issue.id}`;
@@ -50,6 +54,15 @@ gl.issueBoards.IssueCardInner = Vue.extend({
showLabelFooter() {
return this.issue.labels.find(l => this.showLabel(l)) !== undefined;
},
avatarLinkImageConfig() {
return {
title: this.avatarUrlTitle,
styles: 'avatar avatar-inline s20 js-no-trigger',
src: this.issue.assignee.avatar,
size: 20,
alt: this.avatarUrlTitle,
};
},
},
methods: {
showLabel(label) {
@@ -105,20 +118,14 @@ gl.issueBoards.IssueCardInner = Vue.extend({
{{ issueId }}
</span>
</h4>
<a
class="card-assignee has-tooltip js-no-trigger"
:href="assigneeUrl"
:title="assigneeUrlTitle"
v-if="issue.assignee"
data-container="body"
>
<img
class="avatar avatar-inline s20 js-no-trigger"
:src="issue.assignee.avatar"
width="20"
height="20"
:alt="avatarUrlTitle"
/>
<user-avatar-link
data-container='body'
v-if='assigneeUrl'
class='card-assignee has-tooltip js-no-trigger'
:img='avatarLinkImageConfig'
:href='assigneeUrl'
:disabled='false'>
</user-avatar-link>
</a>
</div>
<div class="card-footer" v-if="showLabelFooter">
Loading