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
2c25a7ae
Commit
2c25a7ae
authored
Oct 11, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nest the group_children_path inside the canonical group path
parent
d8e504a8
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
318 additions
and
306 deletions
+318
-306
app/controllers/groups/children_controller.rb
app/controllers/groups/children_controller.rb
+39
-0
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+0
-32
config/routes/group.rb
config/routes/group.rb
+2
-4
spec/controllers/groups/children_controller_spec.rb
spec/controllers/groups/children_controller_spec.rb
+277
-0
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+0
-270
No files found.
app/controllers/groups/children_controller.rb
0 → 100644
View file @
2c25a7ae
module
Groups
class
ChildrenController
<
Groups
::
ApplicationController
before_action
:group
def
index
parent
=
if
params
[
:parent_id
].
present?
GroupFinder
.
new
(
current_user
).
execute
(
id:
params
[
:parent_id
])
else
@group
end
if
parent
.
nil?
render_404
return
end
setup_children
(
parent
)
respond_to
do
|
format
|
format
.
json
do
serializer
=
GroupChildSerializer
.
new
(
current_user:
current_user
)
.
with_pagination
(
request
,
response
)
serializer
.
expand_hierarchy
(
parent
)
if
params
[
:filter
].
present?
render
json:
serializer
.
represent
(
@children
)
end
end
end
protected
def
setup_children
(
parent
)
@children
=
GroupDescendantsFinder
.
new
(
current_user:
current_user
,
parent_group:
parent
,
params:
params
).
execute
@children
=
@children
.
page
(
params
[
:page
])
end
end
end
app/controllers/groups_controller.rb
View file @
2c25a7ae
...
...
@@ -59,31 +59,6 @@ class GroupsController < Groups::ApplicationController
end
end
def
children
parent
=
if
params
[
:parent_id
].
present?
GroupFinder
.
new
(
current_user
).
execute
(
id:
params
[
:parent_id
])
else
@group
end
if
parent
.
nil?
render_404
return
end
setup_children
(
parent
)
respond_to
do
|
format
|
format
.
json
do
serializer
=
GroupChildSerializer
.
new
(
current_user:
current_user
)
.
with_pagination
(
request
,
response
)
serializer
.
expand_hierarchy
(
parent
)
if
params
[
:filter
].
present?
render
json:
serializer
.
represent
(
@children
)
end
end
end
def
activity
respond_to
do
|
format
|
format
.
html
...
...
@@ -120,13 +95,6 @@ class GroupsController < Groups::ApplicationController
protected
def
setup_children
(
parent
)
@children
=
GroupDescendantsFinder
.
new
(
current_user:
current_user
,
parent_group:
parent
,
params:
params
).
execute
@children
=
@children
.
page
(
params
[
:page
])
end
def
authorize_create_group!
allowed
=
if
params
[
:parent_id
].
present?
parent
=
Group
.
find_by
(
id:
params
[
:parent_id
])
...
...
config/routes/group.rb
View file @
2c25a7ae
...
...
@@ -30,6 +30,8 @@ scope(path: 'groups/*group_id',
end
resources
:variables
,
only:
[
:index
,
:show
,
:update
,
:create
,
:destroy
]
resources
:children
,
only:
[
:index
]
end
end
...
...
@@ -53,9 +55,5 @@ constraints(GroupUrlConstrainer.new) do
patch
'/'
,
action: :update
put
'/'
,
action: :update
delete
'/'
,
action: :destroy
scope
(
path:
'-'
)
do
get
:children
end
end
end
spec/controllers/groups/children_controller_spec.rb
0 → 100644
View file @
2c25a7ae
This diff is collapsed.
Click to expand it.
spec/controllers/groups_controller_spec.rb
View file @
2c25a7ae
This diff is collapsed.
Click to expand it.
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