Commit 463f8307 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch '321567-assignees-widget-ux-fixes' into 'master'

Resolve "Assignees widget UX fixes"

See merge request gitlab-org/gitlab!54800
parents 72416c4b b3df5630
...@@ -31,13 +31,18 @@ export default { ...@@ -31,13 +31,18 @@ export default {
</script> </script>
<template> <template>
<div class="gl-display-flex gl-flex-direction-column"> <div class="gl-display-flex gl-flex-direction-column issuable-assignees">
<div v-if="emptyUsers" data-testid="none"> <div
v-if="emptyUsers"
class="gl-display-flex gl-align-items-center gl-text-gray-500"
data-testid="none"
>
<span> {{ __('None') }} -</span> <span> {{ __('None') }} -</span>
<gl-button <gl-button
data-testid="assign-yourself" data-testid="assign-yourself"
category="tertiary" category="tertiary"
variant="link" variant="link"
class="gl-ml-2"
@click="$emit('assign-self')" @click="$emit('assign-self')"
> >
<span class="gl-text-gray-500 gl-hover-text-blue-800">{{ __('assign yourself') }}</span> <span class="gl-text-gray-500 gl-hover-text-blue-800">{{ __('assign yourself') }}</span>
......
...@@ -281,6 +281,9 @@ export default { ...@@ -281,6 +281,9 @@ export default {
collapseWidget() { collapseWidget() {
this.$refs.toggle.collapse(); this.$refs.toggle.collapse();
}, },
showDivider(list) {
return list.length > 0 && this.isSearchEmpty;
},
}, },
}; };
</script> </script>
...@@ -306,6 +309,7 @@ export default { ...@@ -306,6 +309,7 @@ export default {
<issuable-assignees <issuable-assignees
:users="assignees" :users="assignees"
:issuable-type="issuableType" :issuable-type="issuableType"
class="gl-mt-2"
@assign-self="assignSelf" @assign-self="assignSelf"
/> />
</template> </template>
...@@ -334,12 +338,14 @@ export default { ...@@ -334,12 +338,14 @@ export default {
data-testid="unassign" data-testid="unassign"
@click="selectAssignee()" @click="selectAssignee()"
> >
<span :class="selectedIsEmpty ? 'gl-pl-0' : 'gl-pl-6'">{{ <span
$options.i18n.unassigned :class="selectedIsEmpty ? 'gl-pl-0' : 'gl-pl-6'"
}}</span></gl-dropdown-item class="gl-font-weight-bold"
>{{ $options.i18n.unassigned }}</span
></gl-dropdown-item
> >
<gl-dropdown-divider data-testid="unassign-divider" />
</template> </template>
<gl-dropdown-divider v-if="showDivider(selectedFiltered)" />
<gl-dropdown-item <gl-dropdown-item
v-for="item in selectedFiltered" v-for="item in selectedFiltered"
:key="item.id" :key="item.id"
...@@ -358,8 +364,8 @@ export default { ...@@ -358,8 +364,8 @@ export default {
/> />
</gl-avatar-link> </gl-avatar-link>
</gl-dropdown-item> </gl-dropdown-item>
<gl-dropdown-divider v-if="!selectedIsEmpty" data-testid="selected-user-divider" />
<template v-if="showCurrentUser"> <template v-if="showCurrentUser">
<gl-dropdown-divider />
<gl-dropdown-item <gl-dropdown-item
data-testid="unselected-participant" data-testid="unselected-participant"
@click.stop="selectAssignee(currentUser)" @click.stop="selectAssignee(currentUser)"
...@@ -370,12 +376,12 @@ export default { ...@@ -370,12 +376,12 @@ export default {
:label="currentUser.name" :label="currentUser.name"
:sub-label="currentUser.username" :sub-label="currentUser.username"
:src="currentUser.avatarUrl" :src="currentUser.avatarUrl"
class="gl-align-items-center" class="gl-align-items-center gl-pl-6!"
/> />
</gl-avatar-link> </gl-avatar-link>
</gl-dropdown-item> </gl-dropdown-item>
<gl-dropdown-divider />
</template> </template>
<gl-dropdown-divider v-if="showDivider(unselectedFiltered)" />
<gl-dropdown-item <gl-dropdown-item
v-for="unselectedUser in unselectedFiltered" v-for="unselectedUser in unselectedFiltered"
:key="unselectedUser.id" :key="unselectedUser.id"
......
...@@ -83,7 +83,7 @@ export default { ...@@ -83,7 +83,7 @@ export default {
<assignee-avatar-link :user="user" :issuable-type="issuableType" /> <assignee-avatar-link :user="user" :issuable-type="issuableType" />
</div> </div>
</div> </div>
<div v-if="renderShowMoreSection" class="user-list-more"> <div v-if="renderShowMoreSection" class="user-list-more gl-hover-text-blue-800">
<button <button
type="button" type="button"
class="btn-link" class="btn-link"
......
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
{{ __('Edit') }} {{ __('Edit') }}
</gl-button> </gl-button>
</div> </div>
<div v-show="!edit" class="gl-text-gray-500" data-testid="collapsed-content"> <div v-show="!edit" data-testid="collapsed-content">
<slot name="collapsed">{{ __('None') }}</slot> <slot name="collapsed">{{ __('None') }}</slot>
</div> </div>
<div v-show="edit" data-testid="expanded-content"> <div v-show="edit" data-testid="expanded-content">
......
<script> <script>
import { GlDropdown, GlDropdownForm } from '@gitlab/ui'; import { GlDropdown, GlDropdownForm, GlDropdownDivider } from '@gitlab/ui';
export default { export default {
components: { components: {
GlDropdownForm, GlDropdownForm,
GlDropdown, GlDropdown,
GlDropdownDivider,
}, },
props: { props: {
headerText: { headerText: {
...@@ -20,8 +21,12 @@ export default { ...@@ -20,8 +21,12 @@ export default {
</script> </script>
<template> <template>
<gl-dropdown class="show" :text="text" :header-text="headerText" @toggle="$emit('toggle')"> <gl-dropdown class="show" :text="text" @toggle="$emit('toggle')">
<template #header>
<p class="gl-font-weight-bold gl-text-center gl-mt-2 gl-mb-4">{{ headerText }}</p>
<gl-dropdown-divider />
<slot name="search"></slot> <slot name="search"></slot>
</template>
<gl-dropdown-form> <gl-dropdown-form>
<slot name="items"></slot> <slot name="items"></slot>
</gl-dropdown-form> </gl-dropdown-form>
......
...@@ -125,3 +125,9 @@ ...@@ -125,3 +125,9 @@
.issuable-tag-valign { .issuable-tag-valign {
vertical-align: 1px; vertical-align: 1px;
} }
.issuable-assignees {
a:not(.btn) {
color: inherit;
}
}
import { GlSearchBoxByType } from '@gitlab/ui'; import { GlSearchBoxByType, GlDropdown } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import { nextTick } from 'vue'; import { nextTick } from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
...@@ -86,6 +86,7 @@ describe('BoardCardAssigneeDropdown', () => { ...@@ -86,6 +86,7 @@ describe('BoardCardAssigneeDropdown', () => {
SidebarEditableItem, SidebarEditableItem,
MultiSelectDropdown, MultiSelectDropdown,
GlSearchBoxByType, GlSearchBoxByType,
GlDropdown,
}, },
}); });
}; };
......
import { GlDropdown } from '@gitlab/ui';
import { getByText } from '@testing-library/dom'; import { getByText } from '@testing-library/dom';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import MultiSelectDropdown from '~/vue_shared/components/sidebar/multiselect_dropdown.vue'; import MultiSelectDropdown from '~/vue_shared/components/sidebar/multiselect_dropdown.vue';
...@@ -25,6 +26,9 @@ describe('MultiSelectDropdown Component', () => { ...@@ -25,6 +26,9 @@ describe('MultiSelectDropdown Component', () => {
slots: { slots: {
search: '<p>Search</p>', search: '<p>Search</p>',
}, },
stubs: {
GlDropdown,
},
}); });
expect(getByText(wrapper.element, 'Search')).toBeDefined(); expect(getByText(wrapper.element, 'Search')).toBeDefined();
}); });
......
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