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
ccee2aea
Commit
ccee2aea
authored
Jul 19, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed duplicate labels from the dropdown on dashboard
parent
47d8fb84
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
22 deletions
+16
-22
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+5
-9
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+1
-1
app/views/shared/issuable/_label_dropdown.html.haml
app/views/shared/issuable/_label_dropdown.html.haml
+2
-4
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+8
-8
No files found.
app/helpers/issuables_helper.rb
View file @
ccee2aea
...
...
@@ -7,16 +7,16 @@ module IssuablesHelper
"right-sidebar-
#{
sidebar_gutter_collapsed?
?
'collapsed'
:
'expanded'
}
"
end
def
multi_label_name
(
current_labels
,
selected_param
,
default_label
)
if
current_labels
.
any?
def
multi_label_name
(
current_labels
,
default_label
)
if
!
current_labels
.
nil?
&&
current_labels
.
any?
title
=
current_labels
.
first
.
try
(
:title
)
if
current_labels
.
count
>
1
"
#{
title
}
+
#{
current_labels
.
count
-
1
}
more"
if
current_labels
.
size
>
1
"
#{
title
}
+
#{
current_labels
.
size
-
1
}
more"
else
title
end
else
selected_param
.
presence
||
default_label
default_label
end
end
...
...
@@ -66,10 +66,6 @@ module IssuablesHelper
end
end
def
selected_labels
(
project
,
label_query
)
Label
.
where
(
label_query
.
merge
(
project_id:
project
)).
pluck
(
:title
).
uniq
end
private
def
sidebar_gutter_collapsed?
...
...
app/views/shared/issuable/_filter.html.haml
View file @
ccee2aea
...
...
@@ -24,7 +24,7 @@
=
render
"shared/issuable/milestone_dropdown"
,
selected:
(
@issuable_finder
.
milestones
.
first
unless
@issuable_finder
.
milestones
.
nil?
),
name: :milestone_title
,
show_any:
true
,
show_upcoming:
true
.filter-item.inline.labels-filter
=
render
"shared/issuable/label_dropdown"
,
selected:
@issuable_finder
.
labels
,
use_id:
false
,
selected_toggle:
params
[
:label_name
],
data_options:
{
field_name:
"label_name[]"
},
show_create:
controller
.
controller_name
!=
"groups"
=
render
"shared/issuable/label_dropdown"
,
selected:
@issuable_finder
.
labels
.
select
(
:title
).
uniq
,
use_id:
false
,
selected_toggle:
params
[
:label_name
],
data_options:
{
field_name:
"label_name[]"
},
show_create:
controller
.
controller_name
!=
"groups"
.pull-right
=
render
'shared/sort_dropdown'
...
...
app/views/shared/issuable/_label_dropdown.html.haml
View file @
ccee2aea
...
...
@@ -15,13 +15,11 @@
-
if
selected
-
selected
.
each
do
|
label
|
-
id
=
label
.
try
(
:id
)
||
label
-
title
=
label
.
try
(
:title
)
||
label
=
hidden_field_tag
data_options
[
:field_name
],
use_id
?
id
:
title
,
id:
nil
=
hidden_field_tag
data_options
[
:field_name
],
use_id
?
label
.
try
(
:id
)
:
label
.
try
(
:title
),
id:
nil
.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?
||
selected
.
empty?
)
}
=
h
(
multi_label_name
(
selected
,
selected_toggle
.
to_a
.
first
,
"Labels"
))
=
h
(
multi_label_name
(
selected
,
"Labels"
))
=
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
}
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
ccee2aea
...
...
@@ -108,30 +108,30 @@
.js-due-date-calendar
-
if
issuable
.
project
.
labels
.
any?
-
selected_labels
=
issuable
.
labels
.block.labels
.sidebar-collapsed-icon
=
icon
(
'tags'
)
%span
=
issuable
.
labels_array
.
size
=
selected_labels
.
size
.title.hide-collapsed
Labels
=
icon
(
'spinner spin'
,
class:
'block-loading'
)
-
if
can_edit_issuable
=
link_to
'Edit'
,
'#'
,
class:
'edit-link pull-right'
.value.bold.issuable-show-labels.hide-collapsed
{
class:
(
"has-labels"
if
issuable
.
labels_array
.
any?
)
}
-
if
issuable
.
labels_array
.
any?
-
issuable
.
labels_array
.
each
do
|
label
|
.value.bold.issuable-show-labels.hide-collapsed
{
class:
(
"has-labels"
if
selected_labels
.
any?
)
}
-
if
selected_labels
.
any?
-
selected_labels
.
each
do
|
label
|
=
link_to_label
(
label
,
type:
issuable
.
to_ability_name
)
-
else
%span
.no-value
None
.selectbox.hide-collapsed
-
selected_labels
=
issuable
.
labels
-
issuable
.
labels
.
each
do
|
label
|
-
selected_labels
.
each
do
|
label
|
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[label_names][]"
,
label
.
id
,
id:
nil
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-multiselect.js-label-sidebar-dropdown
{
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
.
empty?
)}
=
h
(
multi_label_name
(
selected_labels
,
selected_labels
.
first
,
"Labels"
))
%span
.dropdown-toggle-text
{
class:
(
"is-default"
if
selected_
labels
.
empty?
)}
=
h
(
multi_label_name
(
selected_labels
,
"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