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
Tatuya Kamada
gitlab-ce
Commits
b10e5764
Commit
b10e5764
authored
Sep 20, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
List only labels that belongs to the group on the group issues page
parent
baf47a0b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
16 deletions
+23
-16
app/controllers/dashboard/labels_controller.rb
app/controllers/dashboard/labels_controller.rb
+1
-6
app/controllers/groups/labels_controller.rb
app/controllers/groups/labels_controller.rb
+9
-1
app/finders/labels_finder.rb
app/finders/labels_finder.rb
+10
-9
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+3
-0
No files found.
app/controllers/dashboard/labels_controller.rb
View file @
b10e5764
class
Dashboard::LabelsController
<
Dashboard
::
ApplicationController
def
index
labels
=
LabelsFinder
.
new
(
current_user
,
project_id:
projects
)
.
execute
.
select
(
:id
,
:title
,
:color
)
.
uniq
(
:title
)
respond_to
do
|
format
|
format
.
json
{
render
json:
labels
}
format
.
json
{
render
json:
LabelsFinder
.
new
(
current_user
).
execute
}
end
end
end
app/controllers/groups/labels_controller.rb
View file @
b10e5764
...
...
@@ -8,9 +8,17 @@ class Groups::LabelsController < Groups::ApplicationController
respond_to
:html
def
index
respond_to
do
|
format
|
format
.
html
do
@labels
=
@group
.
labels
.
page
(
params
[
:page
])
end
format
.
json
do
render
json:
LabelsFinder
.
new
(
current_user
,
group_id:
@group
.
id
).
execute
end
end
end
def
new
@label
=
@group
.
labels
.
new
end
...
...
app/finders/labels_finder.rb
View file @
b10e5764
...
...
@@ -20,13 +20,17 @@ class LabelsFinder < UnionFinder
label_ids
<<
Label
.
where
(
project_id:
projects
.
select
(
:id
)).
select
(
:id
)
end
def
sort
(
items
)
items
.
reorder
(
title: :asc
,
type: :desc
)
end
def
with_title
(
items
)
items
=
items
.
where
(
title:
title
)
if
title
.
present?
items
end
def
sort
(
items
)
items
.
reorder
(
title: :asc
)
def
group_id
params
[
:group_id
].
presence
end
def
project_id
...
...
@@ -40,13 +44,10 @@ class LabelsFinder < UnionFinder
def
projects
return
@projects
if
defined?
(
@projects
)
if
project_id
@projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
.
where
(
id:
project_id
)
.
reorder
(
nil
)
else
@projects
=
Project
.
none
end
@projects
=
@projects
.
joins
(
:namespace
).
where
(
namespaces:
{
id:
group_id
,
type:
'Group'
})
if
group_id
@projects
=
@projects
.
where
(
id:
project_id
)
if
project_id
@projects
=
@projects
.
reorder
(
nil
)
@projects
end
...
...
app/helpers/labels_helper.rb
View file @
b10e5764
...
...
@@ -172,7 +172,10 @@ module LabelsHelper
end
def
labels_filter_path
return
group_labels_path
(
@group
,
:json
)
if
@group
project
=
@target_project
||
@project
if
project
namespace_project_labels_path
(
project
.
namespace
,
project
,
:json
)
else
...
...
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