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
28c44004
Commit
28c44004
authored
Sep 05, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pagination for children
parent
80780018
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+1
-1
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+18
-0
No files found.
app/controllers/groups_controller.rb
View file @
28c44004
...
@@ -46,7 +46,6 @@ class GroupsController < Groups::ApplicationController
...
@@ -46,7 +46,6 @@ class GroupsController < Groups::ApplicationController
def
show
def
show
@children
=
GroupChildrenFinder
.
new
(
current_user
,
parent_group:
@group
,
params:
params
).
execute
@children
=
GroupChildrenFinder
.
new
(
current_user
,
parent_group:
@group
,
params:
params
).
execute
@children
=
@children
.
page
(
params
[
:page
])
@children
=
@children
.
page
(
params
[
:page
])
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -71,6 +70,7 @@ class GroupsController < Groups::ApplicationController
...
@@ -71,6 +70,7 @@ class GroupsController < Groups::ApplicationController
end
end
@children
=
GroupChildrenFinder
.
new
(
current_user
,
parent_group:
parent
,
params:
params
).
execute
@children
=
GroupChildrenFinder
.
new
(
current_user
,
parent_group:
parent
,
params:
params
).
execute
@children
=
@children
.
page
(
params
[
:page
])
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
do
format
.
json
do
...
...
spec/controllers/groups_controller_spec.rb
View file @
28c44004
...
@@ -466,6 +466,24 @@ describe GroupsController do
...
@@ -466,6 +466,24 @@ describe GroupsController do
end
end
end
end
end
end
context
'pagination'
do
let!
(
:other_subgroup
)
{
create
(
:group
,
:public
,
parent:
group
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
namespace:
group
)
}
let!
(
:first_page_subgroups
)
{
create_list
(
:group
,
Kaminari
.
config
.
default_per_page
,
parent:
group
)
}
it
'contains all subgroups'
do
get
:children
,
id:
group
.
to_param
,
sort:
'id'
,
format: :json
expect
(
assigns
(
:children
)).
to
contain_exactly
(
*
first_page_subgroups
)
end
it
'contains the project and group on the second page'
do
get
:children
,
id:
group
.
to_param
,
sort:
'id'
,
page:
2
,
format: :json
expect
(
assigns
(
:children
)).
to
contain_exactly
(
other_subgroup
,
project
)
end
end
end
end
context
'for a POST request'
do
context
'for a POST request'
do
...
...
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