Commit e3daa73f authored by Bob Van Landuyt's avatar Bob Van Landuyt

Setup children in a a method and reuse for both calls

parent 9781ac55
...@@ -45,8 +45,7 @@ class GroupsController < Groups::ApplicationController ...@@ -45,8 +45,7 @@ class GroupsController < Groups::ApplicationController
end end
def show def show
@children = GroupChildrenFinder.new(current_user, parent_group: @group, params: params).execute setup_children(@group)
@children = @children.page(params[:page])
respond_to do |format| respond_to do |format|
format.html format.html
...@@ -69,8 +68,7 @@ class GroupsController < Groups::ApplicationController ...@@ -69,8 +68,7 @@ class GroupsController < Groups::ApplicationController
render_404 render_404
end end
@children = GroupChildrenFinder.new(current_user, parent_group: parent, params: params).execute setup_children(parent)
@children = @children.page(params[:page])
respond_to do |format| respond_to do |format|
format.json do format.json do
...@@ -119,6 +117,11 @@ class GroupsController < Groups::ApplicationController ...@@ -119,6 +117,11 @@ class GroupsController < Groups::ApplicationController
protected 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 def setup_projects
set_non_archived_param set_non_archived_param
params[:sort] ||= 'latest_activity_desc' params[:sort] ||= 'latest_activity_desc'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment