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

rename assign select to user select

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