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
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
Hide 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
...
@@ -7,16 +7,16 @@ module IssuablesHelper
"right-sidebar-
#{
sidebar_gutter_collapsed?
?
'collapsed'
:
'expanded'
}
"
"right-sidebar-
#{
sidebar_gutter_collapsed?
?
'collapsed'
:
'expanded'
}
"
end
end
def
multi_label_name
(
current_labels
,
selected_param
,
default_label
)
def
multi_label_name
(
current_labels
,
default_label
)
if
current_labels
.
any?
if
!
current_labels
.
nil?
&&
current_labels
.
any?
title
=
current_labels
.
first
.
try
(
:title
)
title
=
current_labels
.
first
.
try
(
:title
)
if
current_labels
.
count
>
1
if
current_labels
.
size
>
1
"
#{
title
}
+
#{
current_labels
.
count
-
1
}
more"
"
#{
title
}
+
#{
current_labels
.
size
-
1
}
more"
else
else
title
title
end
end
else
else
selected_param
.
presence
||
default_label
default_label
end
end
end
end
...
@@ -66,10 +66,6 @@ module IssuablesHelper
...
@@ -66,10 +66,6 @@ module IssuablesHelper
end
end
end
end
def
selected_labels
(
project
,
label_query
)
Label
.
where
(
label_query
.
merge
(
project_id:
project
)).
pluck
(
:title
).
uniq
end
private
private
def
sidebar_gutter_collapsed?
def
sidebar_gutter_collapsed?
...
...
app/views/shared/issuable/_filter.html.haml
View file @
ccee2aea
...
@@ -24,7 +24,7 @@
...
@@ -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
=
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
.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
.pull-right
=
render
'shared/sort_dropdown'
=
render
'shared/sort_dropdown'
...
...
app/views/shared/issuable/_label_dropdown.html.haml
View file @
ccee2aea
...
@@ -15,13 +15,11 @@
...
@@ -15,13 +15,11 @@
-
if
selected
-
if
selected
-
selected
.
each
do
|
label
|
-
selected
.
each
do
|
label
|
-
id
=
label
.
try
(
:id
)
||
label
=
hidden_field_tag
data_options
[
:field_name
],
use_id
?
label
.
try
(
:id
)
:
label
.
try
(
:title
),
id:
nil
-
title
=
label
.
try
(
:title
)
||
label
=
hidden_field_tag
data_options
[
:field_name
],
use_id
?
id
:
title
,
id:
nil
.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?
||
selected
.
empty?
)
}
%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'
)
=
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
}
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
ccee2aea
...
@@ -108,30 +108,30 @@
...
@@ -108,30 +108,30 @@
.js-due-date-calendar
.js-due-date-calendar
-
if
issuable
.
project
.
labels
.
any?
-
if
issuable
.
project
.
labels
.
any?
-
selected_labels
=
issuable
.
labels
.block.labels
.block.labels
.sidebar-collapsed-icon
.sidebar-collapsed-icon
=
icon
(
'tags'
)
=
icon
(
'tags'
)
%span
%span
=
issuable
.
labels_array
.
size
=
selected_labels
.
size
.title.hide-collapsed
.title.hide-collapsed
Labels
Labels
=
icon
(
'spinner spin'
,
class:
'block-loading'
)
=
icon
(
'spinner spin'
,
class:
'block-loading'
)
-
if
can_edit_issuable
-
if
can_edit_issuable
=
link_to
'Edit'
,
'#'
,
class:
'edit-link pull-right'
=
link_to
'Edit'
,
'#'
,
class:
'edit-link pull-right'
.value.bold.issuable-show-labels.hide-collapsed
{
class:
(
"has-labels"
if
issuable
.
labels_array
.
any?
)
}
.value.bold.issuable-show-labels.hide-collapsed
{
class:
(
"has-labels"
if
selected_labels
.
any?
)
}
-
if
issuable
.
labels_array
.
any?
-
if
selected_labels
.
any?
-
issuable
.
labels_array
.
each
do
|
label
|
-
selected_labels
.
each
do
|
label
|
=
link_to_label
(
label
,
type:
issuable
.
to_ability_name
)
=
link_to_label
(
label
,
type:
issuable
.
to_ability_name
)
-
else
-
else
%span
.no-value
None
%span
.no-value
None
.selectbox.hide-collapsed
.selectbox.hide-collapsed
-
selected_labels
=
issuable
.
labels
-
selected_labels
.
each
do
|
label
|
-
issuable
.
labels
.
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
.dropdown
.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
)}}
%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?
)}
%span
.dropdown-toggle-text
{
class:
(
"is-default"
if
selected_
labels
.
empty?
)}
=
h
(
multi_label_name
(
selected_labels
,
selected_labels
.
first
,
"Labels"
))
=
h
(
multi_label_name
(
selected_labels
,
"Labels"
))
=
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"
=
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