Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-09-19 12:05:31 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-04 23:49:41 +0300
commite3daa73fbfce6f178de512aeb165072f1ffde503 (patch)
tree941ee4043ec1516eca70d4ad9f6291ed703b02c6 /app/controllers/groups_controller.rb
parent9781ac552d4ae41983b2d95768e0fb06817e0ef9 (diff)
Setup children in a a method and reuse for both calls
Diffstat (limited to 'app/controllers/groups_controller.rb')
-rw-r--r--app/controllers/groups_controller.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 575d5476867..d35364ffe1e 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -45,8 +45,7 @@ class GroupsController < Groups::ApplicationController
end
def show
- @children = GroupChildrenFinder.new(current_user, parent_group: @group, params: params).execute
- @children = @children.page(params[:page])
+ setup_children(@group)
respond_to do |format|
format.html
@@ -69,8 +68,7 @@ class GroupsController < Groups::ApplicationController
render_404
end
- @children = GroupChildrenFinder.new(current_user, parent_group: parent, params: params).execute
- @children = @children.page(params[:page])
+ setup_children(parent)
respond_to do |format|
format.json do
@@ -119,6 +117,11 @@ class GroupsController < Groups::ApplicationController
protected
+ def setup_children(parent)
+ @children = GroupChildrenFinder.new(current_user, parent_group: parent, params: params).execute
+ @children = @children.page(params[:page])
+ end
+
def setup_projects
set_non_archived_param
params[:sort] ||= 'latest_activity_desc'