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
Léo-Paul Géneau
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
...
@@ -126,8 +126,10 @@ class GitLabDropdown
@
selectFirstRow
()
@
selectFirstRow
()
# Event listeners
# Event listeners
@
dropdown
.
on
"shown.bs.dropdown"
,
@
opened
@
dropdown
.
on
"shown.bs.dropdown"
,
@
opened
@
dropdown
.
on
"hidden.bs.dropdown"
,
@
hidden
@
dropdown
.
on
"hidden.bs.dropdown"
,
@
hidden
@
dropdown
.
on
"click"
,
".dropdown-menu"
,
@
shouldPropagate
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
@
dropdown
.
find
(
".dropdown-toggle-page, .dropdown-menu-back"
).
on
"click"
,
(
e
)
=>
@
dropdown
.
find
(
".dropdown-toggle-page, .dropdown-menu-back"
).
on
"click"
,
(
e
)
=>
...
@@ -177,6 +179,10 @@ class GitLabDropdown
...
@@ -177,6 +179,10 @@ class GitLabDropdown
@
appendMenu
(
full_html
)
@
appendMenu
(
full_html
)
shouldPropagate
:
(
e
)
=>
if
@
options
.
multiSelect
e
.
stopPropagation
()
opened
:
=>
opened
:
=>
contentHtml
=
$
(
'.dropdown-content'
,
@
dropdown
).
html
()
contentHtml
=
$
(
'.dropdown-content'
,
@
dropdown
).
html
()
if
@
remote
&&
contentHtml
is
""
if
@
remote
&&
contentHtml
is
""
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
22aef628
...
@@ -13,6 +13,7 @@ class @LabelsSelect
...
@@ -13,6 +13,7 @@ class @LabelsSelect
showNo
=
$dropdown
.
data
(
'show-no'
)
showNo
=
$dropdown
.
data
(
'show-no'
)
showAny
=
$dropdown
.
data
(
'show-any'
)
showAny
=
$dropdown
.
data
(
'show-any'
)
defaultLabel
=
$dropdown
.
data
(
'default-label'
)
defaultLabel
=
$dropdown
.
data
(
'default-label'
)
abilityName
=
$dropdown
.
data
(
'ability-name'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$value
=
$block
.
find
(
'.value'
)
$value
=
$block
.
find
(
'.value'
)
...
@@ -195,16 +196,17 @@ class @LabelsSelect
...
@@ -195,16 +196,17 @@ class @LabelsSelect
.
map
(
->
.
map
(
->
@
value
@
value
).
get
()
).
get
()
# need inline-block here instead of show,
console
.
log
'selected'
,
selected
# which will default to the element's style in this case inline.
data
=
{}
selected
=
if
selected
.
length
then
selected
else
[
''
]
data
[
abilityName
]
=
{}
data
[
abilityName
].
label_ids
=
selected
if
not
selected
.
length
data
[
abilityName
].
label_ids
=
[
''
]
$loading
.
fadeIn
()
$loading
.
fadeIn
()
$
.
ajax
(
$
.
ajax
(
type
:
'PUT'
type
:
'PUT'
url
:
issueURL
url
:
issueURL
data
:
data
:
data
issue
:
assignee_id
:
selected
).
done
(
data
)
->
).
done
(
data
)
->
$loading
.
fadeOut
()
$loading
.
fadeOut
()
$selectbox
.
hide
()
$selectbox
.
hide
()
...
...
app/assets/javascripts/milestone_select.js.coffee
View file @
22aef628
...
@@ -11,6 +11,7 @@ class @MilestoneSelect
...
@@ -11,6 +11,7 @@ class @MilestoneSelect
useId
=
$dropdown
.
data
(
'use-id'
)
useId
=
$dropdown
.
data
(
'use-id'
)
defaultLabel
=
$dropdown
.
data
(
'default-label'
)
defaultLabel
=
$dropdown
.
data
(
'default-label'
)
issuableId
=
$dropdown
.
data
(
'issuable-id'
)
issuableId
=
$dropdown
.
data
(
'issuable-id'
)
abilityName
=
$dropdown
.
data
(
'ability-name'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$value
=
$block
.
find
(
'.value'
)
$value
=
$block
.
find
(
'.value'
)
...
@@ -70,14 +71,15 @@ class @MilestoneSelect
...
@@ -70,14 +71,15 @@ class @MilestoneSelect
.
closest
(
'.selectbox'
)
.
closest
(
'.selectbox'
)
.
find
(
'input[type="hidden"]'
)
.
find
(
'input[type="hidden"]'
)
.
val
()
.
val
()
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
milestone_id
=
selected
$loading
$loading
.
fadeIn
()
.
fadeIn
()
$
.
ajax
(
$
.
ajax
(
type
:
'PUT'
type
:
'PUT'
url
:
issueUpdateURL
url
:
issueUpdateURL
data
:
data
:
data
issue
:
milestone_id
:
selected
).
done
(
data
)
->
).
done
(
data
)
->
$loading
.
fadeOut
()
$loading
.
fadeOut
()
$selectbox
.
hide
()
$selectbox
.
hide
()
...
...
app/assets/javascripts/users_select.js.coffee
View file @
22aef628
...
@@ -15,6 +15,7 @@ class @UsersSelect
...
@@ -15,6 +15,7 @@ class @UsersSelect
issueURL
=
$dropdown
.
data
(
'issueUpdate'
)
issueURL
=
$dropdown
.
data
(
'issueUpdate'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$selectbox
=
$dropdown
.
closest
(
'.selectbox'
)
$block
=
$selectbox
.
closest
(
'.block'
)
$block
=
$selectbox
.
closest
(
'.block'
)
abilityName
=
$dropdown
.
data
(
'ability-name'
)
$value
=
$block
.
find
(
'.value'
)
$value
=
$block
.
find
(
'.value'
)
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
$loading
=
$block
.
find
(
'.block-loading'
).
fadeOut
()
...
@@ -86,14 +87,16 @@ class @UsersSelect
...
@@ -86,14 +87,16 @@ class @UsersSelect
selected
=
$dropdown
selected
=
$dropdown
.
closest
(
'.selectbox'
)
.
closest
(
'.selectbox'
)
.
find
(
"input[name='
#{
$dropdown
.
data
(
'field-name'
)
}
']"
).
val
()
.
find
(
"input[name='
#{
$dropdown
.
data
(
'field-name'
)
}
']"
).
val
()
data
=
{}
data
[
abilityName
]
=
{}
data
[
abilityName
].
assignee_id
=
selected
console
.
log
'data'
,
data
$loading
$loading
.
fadeIn
()
.
fadeIn
()
$
.
ajax
(
$
.
ajax
(
type
:
'PUT'
type
:
'PUT'
url
:
issueURL
url
:
issueURL
data
:
data
:
data
issue
:
assignee_id
:
selected
).
done
(
data
)
->
).
done
(
data
)
->
$loading
.
fadeOut
()
$loading
.
fadeOut
()
$selectbox
.
hide
()
$selectbox
.
hide
()
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
22aef628
...
@@ -154,10 +154,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -154,10 +154,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request
.
target_project
,
@merge_request
])
@merge_request
.
target_project
,
@merge_request
])
end
end
format
.
json
do
format
.
json
do
render
json:
{
render
json:
@merge_request
.
to_json
(
include:
[
:milestone
,
:labels
,
:assignee
])
saved:
@merge_request
.
valid?
,
assignee_avatar_url:
@merge_request
.
assignee
.
try
(
:avatar_url
)
}
end
end
end
end
else
else
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
22aef628
%aside
.right-sidebar
{
class:
sidebar_gutter_collapsed_class
}
%aside
.right-sidebar
{
class:
sidebar_gutter_collapsed_class
}
.issuable-sidebar
.issuable-sidebar
.block.issuable-sidebar-header
.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
%span
.issuable-count.hide-collapsed.pull-left
=
issuable
.
iid
=
issuable
.
iid
of
of
...
@@ -43,8 +47,8 @@
...
@@ -43,8 +47,8 @@
.light
None
.light
None
.selectbox.hide-collapsed
.selectbox.hide-collapsed
=
f
.
hidden_field
'assignee_id'
,
value:
issuable
.
assignee
.
id
,
id:
nil
=
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
)
}
})
=
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
.block.milestone
.sidebar-collapsed-icon
.sidebar-collapsed-icon
...
@@ -67,8 +71,8 @@
...
@@ -67,8 +71,8 @@
.light
None
.light
None
.selectbox.hide-collapsed
.selectbox.hide-collapsed
=
f
.
hidden_field
'milestone_id'
,
value:
issuable
.
milestone
.
id
,
id:
nil
=
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
}})
=
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?
-
if
issuable
.
project
.
labels
.
any?
.block.labels
.block.labels
...
@@ -89,9 +93,9 @@
...
@@ -89,9 +93,9 @@
.light
None
.light
None
.selectbox.hide-collapsed
.selectbox.hide-collapsed
-
issuable
.
labels
.
each
do
|
label
|
-
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
.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
%span
.dropdown-toggle-text
Label
Label
=
icon
(
'chevron-down'
)
=
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