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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
Hide 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
...
@@ -198,14 +198,13 @@ class @LabelsSelect
# need inline-block here instead of show,
# need inline-block here instead of show,
# which will default to the element's style in this case inline.
# which will default to the element's style in this case inline.
selected
=
if
selected
.
length
then
selected
else
[
''
]
selected
=
if
selected
.
length
then
selected
else
[
''
]
$loading
$loading
.
fadeIn
()
.
fadeIn
()
$
.
ajax
(
$
.
ajax
(
type
:
'PUT'
type
:
'PUT'
url
:
issueURL
url
:
issueURL
data
:
data
:
issue
:
issue
:
label_ids
:
selected
assignee_id
:
selected
).
done
(
data
)
->
).
done
(
data
)
->
$loading
.
fadeOut
()
$loading
.
fadeOut
()
$selectbox
.
hide
()
$selectbox
.
hide
()
...
...
app/assets/javascripts/users_select.js.coffee
View file @
e8d84110
...
@@ -12,6 +12,11 @@ class @UsersSelect
...
@@ -12,6 +12,11 @@ class @UsersSelect
firstUser
=
$dropdown
.
data
(
'first-user'
)
firstUser
=
$dropdown
.
data
(
'first-user'
)
selectedId
=
$dropdown
.
data
(
'selected'
)
selectedId
=
$dropdown
.
data
(
'selected'
)
defaultLabel
=
$dropdown
.
data
(
'default-label'
)
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
(
$dropdown
.
glDropdown
(
data
:
(
term
,
callback
)
=>
data
:
(
term
,
callback
)
=>
...
@@ -57,11 +62,17 @@ class @UsersSelect
...
@@ -57,11 +62,17 @@ class @UsersSelect
fields
:
[
'name'
,
'username'
]
fields
:
[
'name'
,
'username'
]
selectable
:
true
selectable
:
true
fieldName
:
$dropdown
.
data
(
'field-name'
)
fieldName
:
$dropdown
.
data
(
'field-name'
)
toggleLabel
:
(
selected
)
->
toggleLabel
:
(
selected
)
->
if
selected
&&
'id'
of
selected
if
selected
&&
'id'
of
selected
selected
.
name
selected
.
name
else
else
defaultLabel
defaultLabel
hidden
:
->
$selectbox
.
hide
()
$value
.
show
()
clicked
:
->
clicked
:
->
page
=
$
(
'body'
).
data
'page'
page
=
$
(
'body'
).
data
'page'
isIssueIndex
=
page
is
'projects:issues:index'
isIssueIndex
=
page
is
'projects:issues:index'
...
@@ -72,7 +83,32 @@ class @UsersSelect
...
@@ -72,7 +83,32 @@ class @UsersSelect
else
if
$dropdown
.
hasClass
'js-filter-submit'
else
if
$dropdown
.
hasClass
'js-filter-submit'
$dropdown
.
closest
(
'form'
).
submit
()
$dropdown
.
closest
(
'form'
).
submit
()
else
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
)
->
renderRow
:
(
user
)
->
username
=
if
user
.
username
then
"@
#{
user
.
username
}
"
else
""
username
=
if
user
.
username
then
"@
#{
user
.
username
}
"
else
""
avatar
=
if
user
.
avatar_url
then
user
.
avatar_url
else
false
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
...
@@ -114,7 +114,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
end
end
format
.
json
do
format
.
json
do
render
json:
@issue
.
to_json
(
include:
[
:milestone
,
:labels
])
render
json:
@issue
.
to_json
(
include:
[
:milestone
,
:labels
,
:assignee
])
end
end
end
end
end
end
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
e8d84110
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
=
icon
(
'user'
)
=
icon
(
'user'
)
.title.hide-collapsed
.title.hide-collapsed
Assignee
Assignee
=
icon
(
'spinner spin'
,
class:
'block-loading'
)
-
if
can?
(
current_user
,
:"admin_
#{
issuable
.
to_ability_name
}
"
,
@project
)
-
if
can?
(
current_user
,
:"admin_
#{
issuable
.
to_ability_name
}
"
,
@project
)
=
link_to
'Edit'
,
'#'
,
class:
'edit-link pull-right'
=
link_to
'Edit'
,
'#'
,
class:
'edit-link pull-right'
.value.bold.hide-collapsed
.value.bold.hide-collapsed
...
@@ -42,7 +43,8 @@
...
@@ -42,7 +43,8 @@
.light
None
.light
None
.selectbox.hide-collapsed
.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
.block.milestone
.sidebar-collapsed-icon
.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