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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
e8d84110
Commit
e8d84110
authored
Mar 16, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds new dropdown ajax to user selection
parent
74c7a537
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
6 deletions
+43
-6
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+2
-3
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+37
-1
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-1
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+3
-1
No files found.
app/assets/javascripts/labels_select.js.coffee
View file @
e8d84110
...
...
@@ -198,14 +198,13 @@ class @LabelsSelect
# need inline-block here instead of show,
# which will default to the element's style in this case inline.
selected
=
if
selected
.
length
then
selected
else
[
''
]
$loading
.
fadeIn
()
$loading
.
fadeIn
()
$
.
ajax
(
type
:
'PUT'
url
:
issueURL
data
:
issue
:
label_ids
:
selected
assignee_id
:
selected
).
done
(
data
)
->
$loading
.
fadeOut
()
$selectbox
.
hide
()
...
...
app/assets/javascripts/users_select.js.coffee
View file @
e8d84110
...
...
@@ -12,6 +12,11 @@ class @UsersSelect
firstUser
=
$dropdown
.
data
(
'first-user'
)
selectedId
=
$dropdown
.
data
(
'selected'
)
defaultLabel
=
$dropdown
.
data
(
'default-label'
)
issueURL
=
$dropdown
.
data
(
'issueUpdate'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$value
=
$block
.
find
(
'.value'
)
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
$dropdown
.
glDropdown
(
data
:
(
term
,
callback
)
=>
...
...
@@ -57,11 +62,17 @@ class @UsersSelect
fields
:
[
'name'
,
'username'
]
selectable
:
true
fieldName
:
$dropdown
.
data
(
'field-name'
)
toggleLabel
:
(
selected
)
->
if
selected
&&
'id'
of
selected
selected
.
name
else
defaultLabel
hidden
:
->
$selectbox
.
hide
()
$value
.
show
()
clicked
:
->
page
=
$
(
'body'
).
data
'page'
isIssueIndex
=
page
is
'projects:issues:index'
...
...
@@ -72,7 +83,32 @@ class @UsersSelect
else
if
$dropdown
.
hasClass
'js-filter-submit'
$dropdown
.
closest
(
'form'
).
submit
()
else
console
.
log
'else'
selected
=
$dropdown
.
closest
(
'.selectbox'
)
.
find
(
"input[name='
#{
$dropdown
.
data
(
'field-name'
)
}
']"
).
val
()
$loading
.
fadeIn
()
$
.
ajax
(
type
:
'PUT'
url
:
issueURL
data
:
issue
:
assignee_id
:
selected
).
done
(
data
)
->
$loading
.
fadeOut
()
$selectbox
.
hide
()
href
=
$value
.
show
()
.
find
(
'.author'
)
.
text
(
data
.
assignee
.
name
)
.
end
()
.
find
(
'a'
)
.
attr
(
'href'
)
splitHref
=
href
.
split
(
'/'
)
splitHref
[
splitHref
.
length
-
1
]
=
data
.
assignee
.
username
$value
.
find
(
'a'
)
.
attr
(
'href'
,
splitHref
.
join
(
'/'
))
renderRow
:
(
user
)
->
username
=
if
user
.
username
then
"@
#{
user
.
username
}
"
else
""
avatar
=
if
user
.
avatar_url
then
user
.
avatar_url
else
false
...
...
app/controllers/projects/issues_controller.rb
View file @
e8d84110
...
...
@@ -114,7 +114,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
format
.
json
do
render
json:
@issue
.
to_json
(
include:
[
:milestone
,
:labels
])
render
json:
@issue
.
to_json
(
include:
[
:milestone
,
:labels
,
:assignee
])
end
end
end
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
e8d84110
...
...
@@ -28,6 +28,7 @@
=
icon
(
'user'
)
.title.hide-collapsed
Assignee
=
icon
(
'spinner spin'
,
class:
'block-loading'
)
-
if
can?
(
current_user
,
:"admin_
#{
issuable
.
to_ability_name
}
"
,
@project
)
=
link_to
'Edit'
,
'#'
,
class:
'edit-link pull-right'
.value.bold.hide-collapsed
...
...
@@ -42,7 +43,8 @@
.light
None
.selectbox.hide-collapsed
=
dropdown_tag
(
"Select assignee"
,
options:
{
toggle_class:
"js-user-search js-author-search"
,
title:
"Filter by user"
,
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
),
selected:
params
[
:author_id
],
field_name:
"author_id"
}
})
=
f
.
hidden_field
'assignee_id'
,
value:
issuable
.
assignee
.
id
,
id:
nil
=
dropdown_tag
(
"Select assignee"
,
options:
{
toggle_class:
"js-user-search js-author-search"
,
title:
"Filter by user"
,
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
),
field_name:
"issue[assignee_id]"
,
issue_update:
namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issuable
.
id
,
:json
)
}
})
.block.milestone
.sidebar-collapsed-icon
...
...
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