Commit 56af0631 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'refactor/move-assignees-vue-component' into 'master'

Move (Multiple) Assignees vue component

See merge request gitlab-org/gitlab-ce!16952
parents fcf34e28 514f22c4
...@@ -6,7 +6,7 @@ import { __ } from '../../locale'; ...@@ -6,7 +6,7 @@ import { __ } from '../../locale';
import Sidebar from '../../right_sidebar'; import Sidebar from '../../right_sidebar';
import eventHub from '../../sidebar/event_hub'; import eventHub from '../../sidebar/event_hub';
import assigneeTitle from '../../sidebar/components/assignees/assignee_title'; import assigneeTitle from '../../sidebar/components/assignees/assignee_title';
import assignees from '../../sidebar/components/assignees/assignees'; import assignees from '../../sidebar/components/assignees/assignees.vue';
import DueDateSelectors from '../../due_date_select'; import DueDateSelectors from '../../due_date_select';
import './sidebar/remove_issue'; import './sidebar/remove_issue';
import IssuableContext from '../../issuable_context'; import IssuableContext from '../../issuable_context';
......
<script>
export default { export default {
name: 'Assignees', name: 'Assignees',
data() {
return {
defaultRenderCount: 5,
defaultMaxCounter: 99,
showLess: true,
};
},
props: { props: {
rootPath: { rootPath: {
type: String, type: String,
...@@ -21,6 +15,13 @@ export default { ...@@ -21,6 +15,13 @@ export default {
required: true, required: true,
}, },
}, },
data() {
return {
defaultRenderCount: 5,
defaultMaxCounter: 99,
showLess: true,
};
},
computed: { computed: {
firstUser() { firstUser() {
return this.users[0]; return this.users[0];
...@@ -101,7 +102,10 @@ export default { ...@@ -101,7 +102,10 @@ export default {
return index === 0 || firstTwo; return index === 0 || firstTwo;
}, },
}, },
template: ` };
</script>
<template>
<div> <div>
<div <div
class="sidebar-collapsed-icon sidebar-collapsed-user" class="sidebar-collapsed-icon sidebar-collapsed-user"
...@@ -114,12 +118,14 @@ export default { ...@@ -114,12 +118,14 @@ export default {
v-if="hasNoUsers" v-if="hasNoUsers"
aria-label="No Assignee" aria-label="No Assignee"
class="fa fa-user" class="fa fa-user"
/> >
</i>
<button <button
type="button" type="button"
class="btn-link" class="btn-link"
v-for="(user, index) in users" v-for="(user, index) in users"
v-if="shouldRenderCollapsedAssignee(index)" v-if="shouldRenderCollapsedAssignee(index)"
:key="user.id"
> >
<img <img
width="24" width="24"
...@@ -184,6 +190,7 @@ export default { ...@@ -184,6 +190,7 @@ export default {
class="user-item" class="user-item"
v-for="(user, index) in users" v-for="(user, index) in users"
v-if="renderAssignee(index)" v-if="renderAssignee(index)"
:key="user.id"
> >
<a <a
class="user-link has-tooltip" class="user-link has-tooltip"
...@@ -220,5 +227,5 @@ export default { ...@@ -220,5 +227,5 @@ export default {
</template> </template>
</div> </div>
</div> </div>
`, </template>
};
import Flash from '../../../flash'; import Flash from '../../../flash';
import AssigneeTitle from './assignee_title'; import AssigneeTitle from './assignee_title';
import Assignees from './assignees'; import Assignees from './assignees.vue';
import Store from '../../stores/sidebar_store'; import Store from '../../stores/sidebar_store';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
...@@ -28,8 +28,8 @@ export default { ...@@ -28,8 +28,8 @@ export default {
}, },
}, },
components: { components: {
'assignee-title': AssigneeTitle, AssigneeTitle,
assignees: Assignees, Assignees,
}, },
methods: { methods: {
assignSelf() { assignSelf() {
......
---
title: Move Assignees vue component
merge_request: 16952
author: George Tsiolis
type: performance
import Vue from 'vue'; import Vue from 'vue';
import Assignee from '~/sidebar/components/assignees/assignees'; import Assignee from '~/sidebar/components/assignees/assignees.vue';
import UsersMock from './mock_data'; import UsersMock from './mock_data';
import UsersMockHelper from '../helpers/user_mock_data_helper'; import UsersMockHelper from '../helpers/user_mock_data_helper';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment