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
3582861c
Commit
3582861c
authored
Jul 16, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed label dropdown bugs with pre-selecting the toggle label
parent
bf1d0cbe
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
8 deletions
+13
-8
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+1
-0
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+3
-2
app/views/shared/issuable/_label_dropdown.html.haml
app/views/shared/issuable/_label_dropdown.html.haml
+4
-2
app/views/shared/issuable/_milestone_dropdown.html.haml
app/views/shared/issuable/_milestone_dropdown.html.haml
+1
-0
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+4
-4
No files found.
app/assets/javascripts/labels_select.js.coffee
View file @
3582861c
...
...
@@ -293,6 +293,7 @@ class @LabelsSelect
else
if
selectedLabels
.
length
is
1
selectedLabels
[
0
]
else
console
.
log
selectedLabels
.
length
,
defaultLabel
defaultLabel
defaultLabel
:
defaultLabel
fieldName
:
$dropdown
.
data
(
'field-name'
)
...
...
app/helpers/issuables_helper.rb
View file @
3582861c
...
...
@@ -10,10 +10,11 @@ module IssuablesHelper
def
multi_label_name
(
current_labels
,
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
]
if
current_labels
.
count
>
1
"
#{
current_labels
[
0
]
}
+
#{
current_labels
.
count
-
1
}
more"
"
#{
title
}
+
#{
current_labels
.
count
-
1
}
more"
else
current_labels
[
0
]
title
end
elsif
current_labels
.
is_a?
(
String
)
if
current_labels
.
nil?
||
current_labels
.
empty?
...
...
app/views/shared/issuable/_label_dropdown.html.haml
View file @
3582861c
...
...
@@ -14,9 +14,11 @@
-
if
selected
.
present?
-
if
selected
.
respond_to?
(
'any?'
)
-
selected
=
project
.
labels
.
find
(
selected
)
-
selected
=
project
.
labels
.
find
_by_id
(
selected
)
||
selected
-
selected
.
each
do
|
label
|
=
hidden_field_tag
data_options
[
:field_name
],
label
.
id
,
id:
nil
,
data:
{
title:
label
.
title
}
-
id
=
label
.
try
(
:id
)
||
label
-
title
=
label
.
try
(
:title
)
||
label
=
hidden_field_tag
data_options
[
:field_name
],
id
,
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?
)
}
...
...
app/views/shared/issuable/_milestone_dropdown.html.haml
View file @
3582861c
-
project
=
@target_project
||
@project
-
extra_class
=
extra_class
||
''
-
selected_text
=
project
.
milestones
.
find_by_id
(
selected
).
try
(
:name
)
-
if
selected
.
present?
=
hidden_field_tag
(
name
,
selected
)
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
3582861c
...
...
@@ -126,11 +126,11 @@
%span
.no-value
None
.selectbox.hide-collapsed
-
issuable
.
labels_array
.
each
do
|
label
|
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[label_names][]"
,
label
.
id
,
id:
nil
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[label_names][]"
,
label
.
id
,
id:
nil
,
data:
{
title:
label
.
title
}
.dropdown
%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"
,
project_id:
(
@project
.
id
if
@project
),
issue_update:
issuable_json_path
(
issuable
),
labels:
(
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
if
@project
)}}
%span
.dropdown-toggle-text
Label
%button
.dropdown-menu-toggle.js-label-select.js-multiselect
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
default_label:
"Labels"
,
field_name:
"#{issuable.to_ability_name}[label_names][]"
,
ability_name:
issuable
.
to_ability_name
,
show_no:
"true"
,
show_any:
"true"
,
project_id:
(
@project
.
id
if
@project
),
issue_update:
issuable_json_path
(
issuable
),
labels:
(
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
if
@project
)}}
%span
.dropdown-toggle-text
{
class:
(
"is-default"
if
issuable
.
labels_array
.
empty?
)}
=
multi_label_name
(
issuable
.
labels_array
,
"Labels"
)
=
icon
(
'chevron-down'
)
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
=
render
partial:
"shared/issuable/label_page_default"
...
...
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