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
c9cd2715
Commit
c9cd2715
authored
Jul 18, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed failing label dropdown tests
parent
eb49e28c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+1
-1
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+10
-2
app/views/shared/issuable/_label_dropdown.html.haml
app/views/shared/issuable/_label_dropdown.html.haml
+4
-4
No files found.
app/assets/javascripts/labels_select.js.coffee
View file @
c9cd2715
...
...
@@ -306,7 +306,7 @@ class @LabelsSelect
$labelInputs
=
$dropdownParent
.
find
"input[name='
#{
@
fieldName
}
']"
# Find the label by its attribute according the dropdown settings
if
$dropdown
.
hasClass
'js-issuable-form-dropdown'
if
$dropdown
.
hasClass
(
'js-issuable-form-dropdown'
)
or
$dropdown
.
hasClass
(
'js-filter-bulk-update'
)
# When settings labels to a issuable we find the label for its ID
whereQuery
=
{
id
:
parseInt
$labelInputs
.
first
().
val
()
}
else
...
...
app/helpers/issuables_helper.rb
View file @
c9cd2715
...
...
@@ -7,7 +7,7 @@ module IssuablesHelper
"right-sidebar-
#{
sidebar_gutter_collapsed?
?
'collapsed'
:
'expanded'
}
"
end
def
multi_label_name
(
current_labels
,
default_label
)
def
multi_label_name
(
current_labels
,
param
,
default_label
)
# current_labels may be a string from before
if
current_labels
.
is_a?
(
Array
)
&&
current_labels
.
any?
title
=
current_labels
[
0
].
try
(
:title
)
||
current_labels
[
0
]
...
...
@@ -22,10 +22,14 @@ module IssuablesHelper
else
current_labels
end
else
if
!
param
.
empty?
param
else
default_label
end
end
end
def
issuable_json_path
(
issuable
)
project
=
issuable
.
project
...
...
@@ -73,6 +77,10 @@ module IssuablesHelper
end
end
def
selected_labels
(
project
,
labelQuery
)
Label
.
where
(
labelQuery
.
merge
(
project_id:
project
))
end
private
def
sidebar_gutter_collapsed?
...
...
app/views/shared/issuable/_label_dropdown.html.haml
View file @
c9cd2715
-
project
=
@target_project
||
@project
-
project
=
@target_project
||
@project
||
@projects
-
show_create
=
local_assigns
.
fetch
(
:show_create
,
true
)
-
extra_options
=
local_assigns
.
fetch
(
:extra_options
,
true
)
-
filter_submit
=
local_assigns
.
fetch
(
:filter_submit
,
true
)
...
...
@@ -18,15 +18,15 @@
-
if
selected_toggle
.
present?
-
labelQuery
=
{
title:
selected_toggle
}
-
if
labelQuery
-
selected
=
project
.
labels
.
where
(
labelQuery
)
-
selected
=
selected_labels
(
project
,
labelQuery
)
-
selected
.
each
do
|
label
|
-
id
=
label
.
try
(
:id
)
||
label
-
title
=
label
.
try
(
:title
)
||
label
=
hidden_field_tag
data_options
[
:field_name
],
useId
?
id
:
title
,
id:
nil
,
data:
{
title:
title
}
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-multiselect
{
class:
classes
.
join
(
' '
),
type:
"button"
,
data:
dropdown_data
}
%span
.dropdown-toggle-text
{
class:
(
"is-default"
if
selected
.
nil?
)
}
=
h
(
multi_label_name
(
selected
.
to_a
,
"Label"
))
%span
.dropdown-toggle-text
{
class:
(
"is-default"
if
selected
.
nil?
||
selected
.
to_a
.
size
==
0
)
}
=
h
(
multi_label_name
(
selected
.
to_a
,
h
(
selected_toggle
.
to_a
[
0
]),
"Label"
))
=
icon
(
'chevron-down'
)
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
=
render
partial:
"shared/issuable/label_page_default"
,
locals:
{
title:
"Filter by label"
,
show_footer:
show_footer
,
show_create:
show_create
}
...
...
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