Commit 4906b385 authored by Simon Knox's avatar Simon Knox

add assignee selector

parent a26f3e59
<template>
<div class="block assignee">
<div class="title append-bottom-10">
Assignee
<a
v-if="canEdit"
class="js-sidebar-dropdown-toggle edit-link pull-right"
href="#"
>
Edit
</a>
</div>
<div class="value">
<div
v-if="board.assignee.name"
class="media"
>
<div class="align-center">
<user-avatar-image
:img-src="board.assignee.avatar_url"
:size="40"
/>
</div>
<div class="media-body">
<div class="bold author">
{{ board.assignee.name }}
</div>
<div class="username">
@{{ board.assignee.username }}
</div>
</div>
</div>
<div v-else>
Any assignee
</div>
</div>
<div class="selectbox" style="display: none">
<input type="hidden" name="assignee_id" v-model="board.assignee_id">
<div class="dropdown">
<button
class="dropdown-menu-toggle wide js-user-search js-author-search js-save-user-data js-board-config-modal"
data-field-name="assignee_id"
data-current-user="true"
data-dropdown-title="Select assignee"
:data-group-id="groupId"
:data-project-id="projectId"
:data-selected="1"
data-toggle="dropdown"
aria-expanded="false"
type="button"
>
<span class="dropdown-toggle-text">
Select assignee
</span> <i aria-hidden="true" class="fa fa-chevron-down" data-hidden="true"></i>
</button>
<div class="dropdown-menu dropdown-select dropdown-menu-paging dropdown-menu-user dropdown-menu-selectable dropdown-menu-author">
<div class="dropdown-input">
<input
autocomplete="off"
class="dropdown-input-field" id=""
placeholder="Search"
type="search"
value=""
>
<i aria-hidden="true" class="fa fa-search dropdown-input-search" data-hidden="true"></i>
<i aria-hidden="true" class="fa fa-times dropdown-input-clear js-dropdown-input-clear" data-hidden="true" role="button"></i>
</div>
<div class="dropdown-content"></div>
<div class="dropdown-loading">
<i aria-hidden="true" class="fa fa-spinner fa-spin" data-hidden="true"></i>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import UsersSelect from '~/users_select';
import UserAvatarImage from '~/vue_shared/components/user_avatar/user_avatar_image.vue';
export default {
props: {
board: {
type: Object,
required: true,
},
canEdit: {
type: Boolean,
required: false,
default: false,
},
groupId: {
type: String,
required: false,
default: '',
},
projectId: {
type: String,
required: false,
default: '',
},
},
components: {
UserAvatarImage,
},
mounted() {
new UsersSelect();
},
};
</script>
...@@ -81,13 +81,12 @@ ...@@ -81,13 +81,12 @@
</form-block> </form-block>
<form-block> <form-block>
<div>Author</div> <assignee-select
<input v-model="board.author_id" /> :board="board"
</form-block> :canEdit="canAdminBoard"
:project-id="projectId"
<form-block> :group-id="groupId"
<div>Assignee</div> />
<input v-model="board.assignee_id" />
</form-block> </form-block>
<form-block <form-block
...@@ -123,6 +122,7 @@ import FormBlock from './form_block.vue'; ...@@ -123,6 +122,7 @@ import FormBlock from './form_block.vue';
import BoardMilestoneSelect from './milestone_select.vue'; import BoardMilestoneSelect from './milestone_select.vue';
import BoardWeightSelect from './weight_select.vue'; import BoardWeightSelect from './weight_select.vue';
import BoardLabelsSelect from './labels_select.vue'; import BoardLabelsSelect from './labels_select.vue';
import AssigneeSelect from './assignee_select.vue';
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {}; window.gl.issueBoards = window.gl.issueBoards || {};
...@@ -148,6 +148,16 @@ export default Vue.extend({ ...@@ -148,6 +148,16 @@ export default Vue.extend({
required: false, required: false,
default: false, default: false,
}, },
projectId: {
type: String,
required: false,
default: '',
},
groupId: {
type: String,
required: false,
default: '',
},
}, },
data() { data() {
return { return {
...@@ -161,11 +171,12 @@ export default Vue.extend({ ...@@ -161,11 +171,12 @@ export default Vue.extend({
}; };
}, },
components: { components: {
BoardMilestoneSelect, AssigneeSelect,
BoardLabelsSelect, BoardLabelsSelect,
BoardMilestoneSelect,
BoardWeightSelect, BoardWeightSelect,
PopupDialog,
FormBlock, FormBlock,
PopupDialog,
}, },
mounted() { mounted() {
if (this.currentBoard && Object.keys(this.currentBoard).length && this.currentPage !== 'new') { if (this.currentBoard && Object.keys(this.currentBoard).length && this.currentPage !== 'new') {
......
<template> <template>
<div class="block labels"> <div class="block labels">
<div class="title append-bottom-10"> <div class="title append-bottom-10">
Labels Labels
<i aria-hidden="true" class="fa fa-spinner fa-spin block-loading" data-hidden="true" style="display: none;"></i> <i aria-hidden="true" class="fa fa-spinner fa-spin block-loading" data-hidden="true" style="display: none;"></i>
......
<template> <template>
<div class="dropdown" :class="{ open: isOpen }"> <div class="dropdown" :class="{ open: isOpen }">
<div class="media"> <div class="title append-bottom-10">
<label class="label-light media-body">{{ title }}</label> {{ title }}
<a <a
v-if="canEdit" v-if="canEdit"
class="edit-link" class="edit-link pull-right"
href="#" href="#"
@click.prevent="toggle" @click.prevent="toggle"
> >
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
<li> <li>
<a <a
href="#" href="#"
@click.prevent.stop="selectWeight(0)" @click.prevent.stop="selectWeight(null)"
> >
<i <i
class="fa fa-check" class="fa fa-check"
v-if="0 === value"></i> v-if="!value"></i>
No weight Any weight
</a> </a>
</li> </li>
<li <li
......
...@@ -28,6 +28,7 @@ gl.issueBoards.BoardsStore = { ...@@ -28,6 +28,7 @@ gl.issueBoards.BoardsStore = {
milestone_id: undefined, milestone_id: undefined,
milestone: {}, milestone: {},
author_id: '', author_id: '',
assignee: {},
assignee_id: '', assignee_id: '',
weight: null, weight: null,
}, },
...@@ -60,6 +61,7 @@ gl.issueBoards.BoardsStore = { ...@@ -60,6 +61,7 @@ gl.issueBoards.BoardsStore = {
this.boardConfig.labels = board.labels || []; this.boardConfig.labels = board.labels || [];
this.boardConfig.author_id = board.author_id; this.boardConfig.author_id = board.author_id;
this.boardConfig.assignee_id = board.assignee_id; this.boardConfig.assignee_id = board.assignee_id;
this.boardConfig.assignee = board.assignee;
}, },
addList (listObj, defaultAvatar) { addList (listObj, defaultAvatar) {
const list = new List(listObj, defaultAvatar); const list = new List(listObj, defaultAvatar);
......
...@@ -442,8 +442,8 @@ function UsersSelect(currentUser, els) { ...@@ -442,8 +442,8 @@ function UsersSelect(currentUser, els) {
} }
if ($el.closest('.add-issues-modal').length) { if ($el.closest('.add-issues-modal').length) {
gl.issueBoards.ModalStore.store.filter[$dropdown.data('field-name')] = user.id; gl.issueBoards.ModalStore.store.filter[$dropdown.data('field-name')] = user.id;
} else if ($el.closest('js-board-config-modal').length) { } else if ($el.closest('.js-board-config-modal').length) {
gl.issueBoards.BoardsStore.boardConfig.authorId = user.id; gl.issueBoards.BoardsStore.boardConfig.assignee = user;
} else if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) { } else if ($dropdown.hasClass('js-filter-submit') && (isIssueIndex || isMRIndex)) {
return Issuable.filterResults($dropdown.closest('form')); return Issuable.filterResults($dropdown.closest('form'));
} else if ($dropdown.hasClass('js-filter-submit')) { } else if ($dropdown.hasClass('js-filter-submit')) {
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
%board-form{ ":milestone-path" => "milestonePath", %board-form{ ":milestone-path" => "milestonePath",
"labels-path" => labels_filter_path, "labels-path" => labels_filter_path,
"project-id" => @project&.id,
"group-id" => @group&.id,
":can-admin-board" => can?(current_user, :admin_board, parent), ":can-admin-board" => can?(current_user, :admin_board, parent),
":scoped-issue-board-feature-enabled" => parent.feature_available?(:scoped_issue_board), ":scoped-issue-board-feature-enabled" => parent.feature_available?(:scoped_issue_board),
"v-if" => "currentPage" } "v-if" => "currentPage" }
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