Commit 60ca1167 authored by Simon Knox's avatar Simon Knox

use handleClick properly for users select

parent 117f9050
...@@ -44,7 +44,8 @@ export default { ...@@ -44,7 +44,8 @@ export default {
}, },
selected: { selected: {
type: Object, type: Object,
required: true, required: false,
default: () => ({}),
}, },
wrapperClass: { wrapperClass: {
type: String, type: String,
...@@ -62,25 +63,24 @@ export default { ...@@ -62,25 +63,24 @@ export default {
}, },
}, },
watch: { watch: {
selected: { selected() {
handler() {
this.initSelect(); this.initSelect();
}, },
deep: true,
},
}, },
methods: { methods: {
initSelect() { initSelect() {
this.$nextTick(() => {
new UsersSelect(null, this.$refs.dropdown, { new UsersSelect(null, this.$refs.dropdown, {
handleClick: this.selectUser, handleClick: this.selectUser,
}); });
});
}, },
selectUser(user, isMarking) { selectUser(user, isMarking) {
debugger if (isMarking) {
if (user.id || isMarking) {
gl.issueBoards.BoardsStore.boardConfig.assignee = user; gl.issueBoards.BoardsStore.boardConfig.assignee = user;
} else { } else {
gl.issueBoards.BoardsStore.boardConfig.assignee = {}; // correctly select "unassigned" in Assignee dropdown
gl.issueBoards.BoardsStore.boardConfig.assignee = { id: undefined };
} }
}, },
}, },
...@@ -141,12 +141,12 @@ export default { ...@@ -141,12 +141,12 @@ export default {
<button <button
class="dropdown-menu-toggle wide" class="dropdown-menu-toggle wide"
ref="dropdown" ref="dropdown"
data-current-user="true" :data-field-name="fieldName"
:data-dropdown-title="placeholderText" :data-dropdown-title="placeholderText"
:data-any-user="anyUserText" :data-any-user="anyUserText"
:data-group-id="groupId" :data-group-id="groupId"
:data-project-id="projectId" :data-project-id="projectId"
:data-selected="board.assignee.id" :data-selected="selected.id"
data-toggle="dropdown" data-toggle="dropdown"
aria-expanded="false" aria-expanded="false"
type="button" type="button"
......
...@@ -377,9 +377,9 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -377,9 +377,9 @@ function UsersSelect(currentUser, els, options = {}) {
}, },
multiSelect: $dropdown.hasClass('js-multiselect'), multiSelect: $dropdown.hasClass('js-multiselect'),
inputMeta: $dropdown.data('input-meta'), inputMeta: $dropdown.data('input-meta'),
clicked: function(clickEvent) { clicked: function(options) {
const { $el, e, isMarking } = clickEvent; const { $el, e, isMarking } = options;
const user = clickEvent.selectedObj; const user = options.selectedObj;
if ($dropdown.hasClass('js-multiselect')) { if ($dropdown.hasClass('js-multiselect')) {
const isActive = $el.hasClass('is-active'); const isActive = $el.hasClass('is-active');
......
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