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
Jérome Perrin
gitlab-ce
Commits
3a69dd20
Commit
3a69dd20
authored
Oct 14, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow dashboard and group issues/MRs to be filtered by label
parent
03b7fe71
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
20 deletions
+55
-20
CHANGELOG
CHANGELOG
+1
-0
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+13
-5
app/models/group_label.rb
app/models/group_label.rb
+9
-0
app/models/group_milestone.rb
app/models/group_milestone.rb
+2
-10
app/services/labels/group_service.rb
app/services/labels/group_service.rb
+26
-0
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+4
-5
No files found.
CHANGELOG
View file @
3a69dd20
...
@@ -45,6 +45,7 @@ v 8.1.0 (unreleased)
...
@@ -45,6 +45,7 @@ v 8.1.0 (unreleased)
- Fix position of hamburger in header for smaller screens (Han Loong Liauw)
- Fix position of hamburger in header for smaller screens (Han Loong Liauw)
- Fix bug where Emojis in Markdown would truncate remaining text (Sakata Sinji)
- Fix bug where Emojis in Markdown would truncate remaining text (Sakata Sinji)
- Persist filters when sorting on admin user page (Jerry Lukins)
- Persist filters when sorting on admin user page (Jerry Lukins)
- Allow dashboard and group issues/MRs to be filtered by label
v 8.0.4
v 8.0.4
- Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)
- Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)
...
...
app/helpers/labels_helper.rb
View file @
3a69dd20
...
@@ -92,11 +92,19 @@ module LabelsHelper
...
@@ -92,11 +92,19 @@ module LabelsHelper
end
end
end
end
def
project_labels_options
(
project
)
def
projects_labels_options
labels
=
project
.
labels
.
to_a
labels
=
labels
.
unshift
(
Label
::
None
)
if
@project
labels
.
unshift
(
Label
::
Any
)
@project
.
labels
options_from_collection_for_select
(
labels
,
'name'
,
'title'
,
params
[
:label_name
])
else
Label
.
where
(
project_id:
@projects
)
end
grouped_labels
=
Labels
::
GroupService
.
new
(
labels
).
execute
grouped_labels
.
unshift
(
Label
::
None
)
grouped_labels
.
unshift
(
Label
::
Any
)
options_from_collection_for_select
(
grouped_labels
,
'name'
,
'title'
,
params
[
:label_name
])
end
end
# Required for Gitlab::Markdown::LabelReferenceFilter
# Required for Gitlab::Markdown::LabelReferenceFilter
...
...
app/models/group_label.rb
0 → 100644
View file @
3a69dd20
class
GroupLabel
attr_accessor
:title
,
:labels
alias_attribute
:name
,
:title
def
initialize
(
title
,
labels
)
@title
=
title
@labels
=
labels
end
end
app/models/group_milestone.rb
View file @
3a69dd20
class
GroupMilestone
class
GroupMilestone
attr_accessor
:title
,
:milestones
alias_attribute
:name
,
:title
alias_attribute
:name
,
:title
def
initialize
(
title
,
milestones
)
def
initialize
(
title
,
milestones
)
...
@@ -7,18 +7,10 @@ class GroupMilestone
...
@@ -7,18 +7,10 @@ class GroupMilestone
@milestones
=
milestones
@milestones
=
milestones
end
end
def
title
@title
end
def
safe_title
def
safe_title
@title
.
parameterize
@title
.
parameterize
end
end
def
milestones
@milestones
end
def
projects
def
projects
milestones
.
map
{
|
milestone
|
milestone
.
project
}
milestones
.
map
{
|
milestone
|
milestone
.
project
}
end
end
...
...
app/services/labels/group_service.rb
0 → 100644
View file @
3a69dd20
module
Labels
class
GroupService
<
::
BaseService
def
initialize
(
project_labels
)
@project_labels
=
project_labels
.
group_by
(
&
:title
)
end
def
execute
build
(
@project_labels
)
end
def
label
(
title
)
if
title
group_label
=
@project_labels
[
title
].
group_by
(
&
:title
)
build
(
group_label
).
first
else
nil
end
end
private
def
build
(
label
)
label
.
map
{
|
title
,
labels
|
GroupLabel
.
new
(
title
,
labels
)
}
end
end
end
app/views/shared/issuable/_filter.html.haml
View file @
3a69dd20
...
@@ -42,11 +42,10 @@
...
@@ -42,11 +42,10 @@
class:
'select2 trigger-submit'
,
include_blank:
true
,
class:
'select2 trigger-submit'
,
include_blank:
true
,
data:
{
placeholder:
'Milestone'
})
data:
{
placeholder:
'Milestone'
})
-
if
@project
.filter-item.inline.labels-filter
.filter-item.inline.labels-filter
=
select_tag
(
'label_name'
,
projects_labels_options
,
=
select_tag
(
'label_name'
,
project_labels_options
(
@project
),
class:
'select2 trigger-submit'
,
include_blank:
true
,
class:
'select2 trigger-submit'
,
include_blank:
true
,
data:
{
placeholder:
'Label'
})
data:
{
placeholder:
'Label'
})
.pull-right
.pull-right
=
render
'shared/sort_dropdown'
=
render
'shared/sort_dropdown'
...
...
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