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
Hide 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
...
@@ -306,7 +306,7 @@ class @LabelsSelect
$labelInputs
=
$dropdownParent
.
find
"input[name='
#{
@
fieldName
}
']"
$labelInputs
=
$dropdownParent
.
find
"input[name='
#{
@
fieldName
}
']"
# Find the label by its attribute according the dropdown settings
# 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
# When settings labels to a issuable we find the label for its ID
whereQuery
=
{
id
:
parseInt
$labelInputs
.
first
().
val
()
}
whereQuery
=
{
id
:
parseInt
$labelInputs
.
first
().
val
()
}
else
else
...
...
app/helpers/issuables_helper.rb
View file @
c9cd2715
...
@@ -7,7 +7,7 @@ module IssuablesHelper
...
@@ -7,7 +7,7 @@ module IssuablesHelper
"right-sidebar-
#{
sidebar_gutter_collapsed?
?
'collapsed'
:
'expanded'
}
"
"right-sidebar-
#{
sidebar_gutter_collapsed?
?
'collapsed'
:
'expanded'
}
"
end
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
# current_labels may be a string from before
if
current_labels
.
is_a?
(
Array
)
&&
current_labels
.
any?
if
current_labels
.
is_a?
(
Array
)
&&
current_labels
.
any?
title
=
current_labels
[
0
].
try
(
:title
)
||
current_labels
[
0
]
title
=
current_labels
[
0
].
try
(
:title
)
||
current_labels
[
0
]
...
@@ -23,7 +23,11 @@ module IssuablesHelper
...
@@ -23,7 +23,11 @@ module IssuablesHelper
current_labels
current_labels
end
end
else
else
default_label
if
!
param
.
empty?
param
else
default_label
end
end
end
end
end
...
@@ -73,6 +77,10 @@ module IssuablesHelper
...
@@ -73,6 +77,10 @@ module IssuablesHelper
end
end
end
end
def
selected_labels
(
project
,
labelQuery
)
Label
.
where
(
labelQuery
.
merge
(
project_id:
project
))
end
private
private
def
sidebar_gutter_collapsed?
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
)
-
show_create
=
local_assigns
.
fetch
(
:show_create
,
true
)
-
extra_options
=
local_assigns
.
fetch
(
:extra_options
,
true
)
-
extra_options
=
local_assigns
.
fetch
(
:extra_options
,
true
)
-
filter_submit
=
local_assigns
.
fetch
(
:filter_submit
,
true
)
-
filter_submit
=
local_assigns
.
fetch
(
:filter_submit
,
true
)
...
@@ -18,15 +18,15 @@
...
@@ -18,15 +18,15 @@
-
if
selected_toggle
.
present?
-
if
selected_toggle
.
present?
-
labelQuery
=
{
title:
selected_toggle
}
-
labelQuery
=
{
title:
selected_toggle
}
-
if
labelQuery
-
if
labelQuery
-
selected
=
project
.
labels
.
where
(
labelQuery
)
-
selected
=
selected_labels
(
project
,
labelQuery
)
-
selected
.
each
do
|
label
|
-
selected
.
each
do
|
label
|
-
id
=
label
.
try
(
:id
)
||
label
-
id
=
label
.
try
(
:id
)
||
label
-
title
=
label
.
try
(
:title
)
||
label
-
title
=
label
.
try
(
:title
)
||
label
=
hidden_field_tag
data_options
[
:field_name
],
useId
?
id
:
title
,
id:
nil
,
data:
{
title:
title
}
=
hidden_field_tag
data_options
[
:field_name
],
useId
?
id
:
title
,
id:
nil
,
data:
{
title:
title
}
.dropdown
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-multiselect
{
class:
classes
.
join
(
' '
),
type:
"button"
,
data:
dropdown_data
}
%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?
)
}
%span
.dropdown-toggle-text
{
class:
(
"is-default"
if
selected
.
nil?
||
selected
.
to_a
.
size
==
0
)
}
=
h
(
multi_label_name
(
selected
.
to_a
,
"Label"
))
=
h
(
multi_label_name
(
selected
.
to_a
,
h
(
selected_toggle
.
to_a
[
0
]),
"Label"
))
=
icon
(
'chevron-down'
)
=
icon
(
'chevron-down'
)
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
.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
}
=
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