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
22aef628
Commit
22aef628
authored
Mar 17, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New dropdowns work on merge requests too!
parent
e8d84110
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
22 deletions
+36
-22
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+6
-0
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+8
-6
app/assets/javascripts/milestone_select.js.coffee
app/assets/javascripts/milestone_select.js.coffee
+5
-3
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+6
-3
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-4
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+10
-6
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
22aef628
...
...
@@ -126,8 +126,10 @@ class GitLabDropdown
@
selectFirstRow
()
# Event listeners
@
dropdown
.
on
"shown.bs.dropdown"
,
@
opened
@
dropdown
.
on
"hidden.bs.dropdown"
,
@
hidden
@
dropdown
.
on
"click"
,
".dropdown-menu"
,
@
shouldPropagate
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
@
dropdown
.
find
(
".dropdown-toggle-page, .dropdown-menu-back"
).
on
"click"
,
(
e
)
=>
...
...
@@ -177,6 +179,10 @@ class GitLabDropdown
@
appendMenu
(
full_html
)
shouldPropagate
:
(
e
)
=>
if
@
options
.
multiSelect
e
.
stopPropagation
()
opened
:
=>
contentHtml
=
$
(
'.dropdown-content'
,
@
dropdown
).
html
()
if
@
remote
&&
contentHtml
is
""
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
22aef628
...
...
@@ -13,6 +13,7 @@ class @LabelsSelect
showNo
=
$dropdown
.
data
(
'show-no'
)
showAny
=
$dropdown
.
data
(
'show-any'
)
defaultLabel
=
$dropdown
.
data
(
'default-label'
)
abilityName
=
$dropdown
.
data
(
'ability-name'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$value
=
$block
.
find
(
'.value'
)
...
...
@@ -195,16 +196,17 @@ class @LabelsSelect
.
map
(
->
@
value
).
get
()
# 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
[
''
]
console
.
log
'selected'
,
selected
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
label_ids
=
selected
if
not
selected
.
length
data
[
abilityName
].
label_ids
=
[
''
]
$loading
.
fadeIn
()
$
.
ajax
(
type
:
'PUT'
url
:
issueURL
data
:
issue
:
assignee_id
:
selected
data
:
data
).
done
(
data
)
->
$loading
.
fadeOut
()
$selectbox
.
hide
()
...
...
app/assets/javascripts/milestone_select.js.coffee
View file @
22aef628
...
...
@@ -11,6 +11,7 @@ class @MilestoneSelect
useId
=
$dropdown
.
data
(
'use-id'
)
defaultLabel
=
$dropdown
.
data
(
'default-label'
)
issuableId
=
$dropdown
.
data
(
'issuable-id'
)
abilityName
=
$dropdown
.
data
(
'ability-name'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$value
=
$block
.
find
(
'.value'
)
...
...
@@ -70,14 +71,15 @@ class @MilestoneSelect
.
closest
(
'.selectbox'
)
.
find
(
'input[type="hidden"]'
)
.
val
()
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
milestone_id
=
selected
$loading
.
fadeIn
()
$
.
ajax
(
type
:
'PUT'
url
:
issueUpdateURL
data
:
issue
:
milestone_id
:
selected
data
:
data
).
done
(
data
)
->
$loading
.
fadeOut
()
$selectbox
.
hide
()
...
...
app/assets/javascripts/users_select.js.coffee
View file @
22aef628
...
...
@@ -15,6 +15,7 @@ class @UsersSelect
issueURL
=
$dropdown
.
data
(
'issueUpdate'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$block
=
$selectbox
.
closest
(
'.block'
)
abilityName
=
$dropdown
.
data
(
'ability-name'
)
$value
=
$block
.
find
(
'.value'
)
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
...
...
@@ -86,14 +87,16 @@ class @UsersSelect
selected
=
$dropdown
.
closest
(
'.selectbox'
)
.
find
(
"input[name='
#{
$dropdown
.
data
(
'field-name'
)
}
']"
).
val
()
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
assignee_id
=
selected
console
.
log
'data'
,
data
$loading
.
fadeIn
()
$
.
ajax
(
type
:
'PUT'
url
:
issueURL
data
:
issue
:
assignee_id
:
selected
data
:
data
).
done
(
data
)
->
$loading
.
fadeOut
()
$selectbox
.
hide
()
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
22aef628
...
...
@@ -154,10 +154,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request
.
target_project
,
@merge_request
])
end
format
.
json
do
render
json:
{
saved:
@merge_request
.
valid?
,
assignee_avatar_url:
@merge_request
.
assignee
.
try
(
:avatar_url
)
}
render
json:
@merge_request
.
to_json
(
include:
[
:milestone
,
:labels
,
:assignee
])
end
end
else
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
22aef628
%aside
.right-sidebar
{
class:
sidebar_gutter_collapsed_class
}
.issuable-sidebar
.block.issuable-sidebar-header
-
if
issuable
.
to_ability_name
==
'merge_request'
-
issuable_url
=
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
issuable
.
id
,
:json
)
-
else
-
issuable_url
=
namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issuable
.
id
,
:json
)
%span
.issuable-count.hide-collapsed.pull-left
=
issuable
.
iid
of
...
...
@@ -43,8 +47,8 @@
.light
None
.selectbox.hide-collapsed
=
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
)
}
})
=
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:
"
#{
issuable
.
to_ability_name
}
[assignee_id]"
,
issue_update:
issuable_url
,
ability_name:
issuable
.
to_ability_name
}
})
.block.milestone
.sidebar-collapsed-icon
...
...
@@ -67,8 +71,8 @@
.light
None
.selectbox.hide-collapsed
=
f
.
hidden_field
'milestone_id'
,
value:
issuable
.
milestone
.
id
,
id:
nil
=
dropdown_tag
(
"Milestone"
,
options:
{
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search milestones"
,
data:
{
show_no:
true
,
field_name:
"issue[milestone_id]"
,
project_id:
@project
.
id
,
issuable_id:
issuable
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
),
issue_update:
namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issuable
.
id
,
:json
)
,
use_id:
true
}})
=
f
.
hidden_field
'milestone_id'
,
value:
issuable
.
milestone
_
id
,
id:
nil
=
dropdown_tag
(
'Milestone'
,
options:
{
title:
'Assign milestone'
,
toggle_class:
'js-milestone-select'
,
filter:
true
,
dropdown_class:
'dropdown-menu-selectable'
,
placeholder:
'Search milestones'
,
data:
{
show_no:
true
,
field_name:
"
#{
issuable
.
to_ability_name
}
[milestone_id]"
,
project_id:
@project
.
id
,
issuable_id:
issuable
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
),
ability_name:
issuable
.
to_ability_name
,
issue_update:
issuable_url
,
use_id:
true
}})
-
if
issuable
.
project
.
labels
.
any?
.block.labels
...
...
@@ -89,9 +93,9 @@
.light
None
.selectbox.hide-collapsed
-
issuable
.
labels
.
each
do
|
label
|
=
hidden_field_tag
'issue[label_names][]'
,
label
.
id
,
id:
nil
=
hidden_field_tag
"{issuable.to_ability_name}[label_names][]"
,
label
.
id
,
id:
nil
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-multiselect
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"
issue[label_names][]"
,
show_no:
"true"
,
show_any:
"true"
,
selected:
issuable
.
label_names
.
join
(
","
),
project_id:
(
@project
.
id
if
@project
),
issue_update:
namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issuable
.
id
,
:json
)
,
labels:
(
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
if
@project
)}}
%button
.dropdown-menu-toggle.js-label-select.js-multiselect
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
field_name:
"
{issuable.to_ability_name}[label_names][]"
,
ability_name:
issuable
.
to_ability_name
,
show_no:
"true"
,
show_any:
"true"
,
selected:
issuable
.
label_names
.
join
(
","
),
project_id:
(
@project
.
id
if
@project
),
issue_update:
issuable_url
,
labels:
(
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
if
@project
)}}
%span
.dropdown-toggle-text
Label
=
icon
(
'chevron-down'
)
...
...
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