Commit 2dbc6b05 authored by Simon Knox's avatar Simon Knox

rename assign select to user select

parent ca938979
......@@ -81,14 +81,18 @@
</form-block>
<form-block>
<assignee-select
<user-select
any-user-text="Any assignee"
:board="board"
field-name="assignee_id"
label="Assignee"
v-model="board.assignee_id"
:selected="board.assignee"
:can-edit="canAdminBoard"
placeholder-text="Select assignee"
:project-id="projectId"
:group-id="groupId"
wrapper-class="assignee"
/>
</form-block>
......@@ -126,7 +130,7 @@ import FormBlock from './form_block.vue';
import BoardMilestoneSelect from './milestone_select.vue';
import BoardWeightSelect from './weight_select.vue';
import BoardLabelsSelect from './labels_select.vue';
import AssigneeSelect from './assignee_select.vue';
import UserSelect from './user_select.vue';
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
......@@ -179,12 +183,12 @@ export default Vue.extend({
};
},
components: {
AssigneeSelect,
BoardLabelsSelect,
BoardMilestoneSelect,
BoardWeightSelect,
FormBlock,
PopupDialog,
UserSelect,
},
computed: {
buttonText() {
......
<template>
<div class="block assignee">
<div class="block" :class="wrapperClass">
<div class="title append-bottom-10">
Assignee
{{ label }}
<a
v-if="canEdit"
class="js-sidebar-dropdown-toggle edit-link pull-right"
......@@ -23,7 +23,7 @@
</div>
<div class="media-body">
<div class="bold author">
{{ selectedName }}
{{ selected.name }}
</div>
<div class="username">
......@@ -32,7 +32,7 @@
</div>
</div>
<div v-else>
Any assignee
{{ anyUserText }}
</div>
</div>
......@@ -44,17 +44,17 @@
ref="dropdown"
:data-field-name="fieldName"
data-current-user="true"
data-dropdown-title="Select assignee"
data-any-user="Any assignee"
:data-dropdown-title="placeholderText"
:data-any-user="anyUserText"
:data-group-id="groupId"
:data-project-id="projectId"
:data-selected="selectedId"
:data-selected="selected.id"
data-toggle="dropdown"
aria-expanded="false"
type="button"
>
<span class="dropdown-toggle-text">
Select assignee
{{ placeholderText }}
</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">
......@@ -85,6 +85,11 @@ import UserAvatarImage from '~/vue_shared/components/user_avatar/user_avatar_ima
export default {
props: {
anyUserText: {
type: String,
required: false,
default: 'Any user',
},
board: {
type: Object,
required: true,
......@@ -103,6 +108,15 @@ export default {
required: false,
default: '',
},
label: {
type: String,
required: true,
},
placeholderText: {
type: String,
required: false,
default: 'Select user',
},
projectId: {
type: String,
required: false,
......@@ -112,28 +126,24 @@ export default {
type: Object,
required: false,
default: () => ({}),
}
},
data() {
return {
selectedId: this.board.assignee_id,
}
},
wrapperClass: {
type: String,
required: false,
default: '',
},
},
components: {
UserAvatarImage,
},
computed: {
hasValue() {
return this.board.assignee_id;
},
selectedName() {
return this.board.assignee ? this.board.assignee.name : '';
return this.selected.id;
},
},
watch: {
board: {
handler() {
this.selectedId = this.board.assignee_id;
this.$nextTick(() => {
new UsersSelect();
});
......
......@@ -20,6 +20,7 @@ class ListIssue {
this.position = obj.relative_position || Infinity;
this.milestone_id = obj.milestone_id;
this.project_id = obj.project_id;
this.weight = obj.weight;
if (obj.project) {
this.project = new IssueProject(obj.project);
......
/* eslint-disable comma-dangle, space-before-function-paren, one-var, no-shadow, dot-notation, max-len */
/* global List */
import _ from 'underscore';
import Vue from 'vue';
import Cookies from 'js-cookie';
import boardsStoreEE from 'ee/boards/stores/boards_store_ee';
import { getUrlParamsArray } from '../../lib/utils/common_utils';
......@@ -59,9 +60,10 @@ gl.issueBoards.BoardsStore = {
this.boardConfig.id = board.id;
this.boardConfig.weight = board.weight;
this.boardConfig.labels = board.labels || [];
Vue.set(this.boardConfig, 'label_ids', board.labels.map(b => b.id));
this.boardConfig.author_id = board.author_id;
this.boardConfig.assignee_id = board.assignee_id;
this.boardConfig.assignee = board.assignee;
Vue.set(this.boardConfig, 'assignee', board.assignee);
},
addList (listObj, defaultAvatar) {
const list = new List(listObj, defaultAvatar);
......
......@@ -41,4 +41,5 @@
"group-id" => @group&.id,
":can-admin-board" => can?(current_user, :admin_board, parent),
":scoped-issue-board-feature-enabled" => parent.feature_available?(:scoped_issue_board),
"weights" => Issue.weight_options,
"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