Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6109a66e
Commit
6109a66e
authored
May 24, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Append selected users to the user dropdown
parent
3d4fc3dd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
6 deletions
+46
-6
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+8
-2
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+31
-1
app/views/projects/boards/components/sidebar/_assignee.html.haml
...ws/projects/boards/components/sidebar/_assignee.html.haml
+5
-1
app/views/shared/issuable/_sidebar_assignees.html.haml
app/views/shared/issuable/_sidebar_assignees.html.haml
+1
-1
app/views/shared/issuable/form/_metadata_issue_assignee.html.haml
...s/shared/issuable/form/_metadata_issue_assignee.html.haml
+1
-1
No files found.
app/assets/javascripts/gl_dropdown.js
View file @
6109a66e
...
...
@@ -468,8 +468,8 @@ GitLabDropdown = (function() {
// Process the data to make sure rendered data
// matches the correct layout
if
(
this
.
fullData
&&
hasMultiSelect
&&
this
.
options
.
processData
)
{
const
inputValue
=
this
.
filterInput
.
val
();
const
inputValue
=
this
.
filterInput
.
val
();
if
(
this
.
fullData
&&
hasMultiSelect
&&
this
.
options
.
processData
&&
inputValue
.
length
===
0
)
{
this
.
options
.
processData
.
call
(
this
.
options
,
inputValue
,
this
.
filteredFullData
(),
this
.
parseData
.
bind
(
this
));
}
...
...
@@ -755,6 +755,12 @@ GitLabDropdown = (function() {
$input
.
attr
(
'
id
'
,
this
.
options
.
inputId
);
}
if
(
this
.
options
.
multiSelect
)
{
Object
.
keys
(
selectedObject
).
forEach
((
attribute
)
=>
{
$input
.
attr
(
`data-
${
attribute
}
`
,
selectedObject
[
attribute
]);
});
}
if
(
this
.
options
.
inputMeta
)
{
$input
.
attr
(
'
data-meta
'
,
selectedObject
[
this
.
options
.
inputMeta
]);
}
...
...
app/assets/javascripts/users_select.js
View file @
6109a66e
...
...
@@ -214,7 +214,37 @@ function UsersSelect(currentUser, els) {
glDropdown
.
options
.
processData
(
term
,
users
,
callback
);
}.
bind
(
this
));
},
processData
:
function
(
term
,
users
,
callback
)
{
processData
:
function
(
term
,
data
,
callback
)
{
let
users
=
data
;
if
(
$dropdown
.
hasClass
(
'
js-multiselect
'
)
&&
term
.
length
===
0
)
{
let
selectedInputs
=
getSelectedUserInputs
();
// Potential duplicate entries when dealing with issue board
// because issue board is also managed by vue
selectedInputs
=
_
.
uniq
(
selectedInputs
,
false
,
a
=>
a
.
value
);
const
selectedUsers
=
selectedInputs
.
filter
((
input
)
=>
{
const
userId
=
parseInt
(
input
.
value
,
10
);
const
inUsersArray
=
users
.
find
(
u
=>
u
.
id
===
userId
);
return
!
inUsersArray
&&
userId
!==
0
;
})
.
map
((
input
)
=>
{
const
userId
=
parseInt
(
input
.
value
,
10
);
const
{
avatarUrl
,
avatar_url
,
id
,
name
,
username
}
=
input
.
dataset
;
return
{
avatar_url
:
avatarUrl
||
avatar_url
,
id
:
userId
,
name
,
username
,
};
});
users
=
data
.
concat
(
selectedUsers
);
}
let
anyUser
;
let
index
;
let
j
;
...
...
app/views/projects/boards/components/sidebar/_assignee.html.haml
View file @
6109a66e
...
...
@@ -14,7 +14,11 @@
name:
"issue[assignee_ids][]"
,
":value"
=>
"assignee.id"
,
"v-if"
=>
"issue.assignees"
,
"v-for"
=>
"assignee in issue.assignees"
}
"v-for"
=>
"assignee in issue.assignees"
,
":data-avatar_url"
=>
"assignee.avatar"
,
":data-name"
=>
"assignee.name"
,
":data-id"
=>
"assignee.id"
,
":data-username"
=>
"assignee.username"
}
.dropdown
%button
.dropdown-menu-toggle.js-user-search.js-author-search.js-multiselect.js-save-user-data.js-issue-board-sidebar
{
type:
"button"
,
ref:
"assigneeDropdown"
,
data:
{
toggle:
"dropdown"
,
field_name:
"issue[assignee_ids][]"
,
first_user:
(
current_user
.
username
if
current_user
),
current_user:
"true"
,
project_id:
@project
.
id
,
null_user:
"true"
,
multi_select:
"true"
,
dropdown:
{
header:
'Assignee(s)'
}
},
":data-issuable-id"
=>
"issue.id"
,
...
...
app/views/shared/issuable/_sidebar_assignees.html.haml
View file @
6109a66e
...
...
@@ -29,7 +29,7 @@
.selectbox.hide-collapsed
-
issuable
.
assignees
.
each
do
|
assignee
|
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[assignee_ids][]"
,
assignee
.
id
,
id:
nil
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[assignee_ids][]"
,
assignee
.
id
,
id:
nil
,
data:
{
avatar_url:
assignee
.
avatar_url
,
name:
assignee
.
name
,
id:
assignee
.
id
,
username:
assignee
.
username
}
-
options
=
{
toggle_class:
'js-user-search js-author-search'
,
title:
'Assign to'
,
filter:
true
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author'
,
placeholder:
'Search users'
,
data:
{
first_user:
(
current_user
.
username
if
current_user
),
current_user:
true
,
project_id:
(
@project
.
id
if
@project
),
author_id:
issuable
.
author_id
,
field_name:
"
#{
issuable
.
to_ability_name
}
[assignee_ids][]"
,
issue_update:
issuable_json_path
(
issuable
),
ability_name:
issuable
.
to_ability_name
,
null_user:
true
}
}
...
...
app/views/shared/issuable/form/_metadata_issue_assignee.html.haml
View file @
6109a66e
...
...
@@ -2,7 +2,7 @@
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
.issuable-form-select-holder.selectbox
-
issuable
.
assignees
.
each
do
|
assignee
|
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[assignee_ids][]"
,
assignee
.
id
,
id:
nil
,
data:
{
meta:
assignee
.
name
}
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[assignee_ids][]"
,
assignee
.
id
,
id:
nil
,
data:
{
meta:
assignee
.
name
,
avatar_url:
assignee
.
avatar_url
,
name:
assignee
.
name
,
id:
assignee
.
id
,
username:
assignee
.
username
}
-
if
issuable
.
assignees
.
length
===
0
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[assignee_ids][]"
,
0
,
id:
nil
,
data:
{
meta:
''
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment