Commit 809045e1 authored by Bob Van Landuyt's avatar Bob Van Landuyt
Browse files

Use the default sort set by the `Sortable` concern

parent cb4a09bb302e
class Dashboard::GroupsController < Dashboard::ApplicationController class Dashboard::GroupsController < Dashboard::ApplicationController
def index def index
@sort = params[:sort] || 'id_desc'
@groups = GroupsFinder.new(current_user, all_available: false).execute @groups = GroupsFinder.new(current_user, all_available: false).execute
# Only show root groups if no parent-id is given # Only show root groups if no parent-id is given
@groups = @groups.where(parent_id: params[:parent_id]) @groups = @groups.where(parent_id: params[:parent_id])
@groups = @groups.search(params[:filter]) if params[:filter].present? @groups = @groups.search(params[:filter]) if params[:filter].present?
@groups = @groups.includes(:route) @groups = @groups.includes(:route)
...@@ -5,9 +3,9 @@ ...@@ -5,9 +3,9 @@
@groups = GroupsFinder.new(current_user, all_available: false).execute @groups = GroupsFinder.new(current_user, all_available: false).execute
# Only show root groups if no parent-id is given # Only show root groups if no parent-id is given
@groups = @groups.where(parent_id: params[:parent_id]) @groups = @groups.where(parent_id: params[:parent_id])
@groups = @groups.search(params[:filter]) if params[:filter].present? @groups = @groups.search(params[:filter]) if params[:filter].present?
@groups = @groups.includes(:route) @groups = @groups.includes(:route)
@groups = @groups.sort(@sort) @groups = @groups.sort(@sort = params[:sort])
@groups = @groups.page(params[:page]) @groups = @groups.page(params[:page])
respond_to do |format| respond_to do |format|
......
Supports Markdown
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