diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-05 19:15:05 -0800 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-05 19:15:05 -0800 |
| commit | bbca6a0abd9f5559fe4abbf2cb2100a0e4717ac8 (patch) | |
| tree | 34b5f2fd0c2301b8d5284700bec64ee272246bc4 /app/controllers | |
| parent | e0aa5c371ea1c633a0648f13cd7bea35f3aea75c (diff) | |
| download | gitlab-ce-bbca6a0abd9f5559fe4abbf2cb2100a0e4717ac8.tar.gz | |
Refactor sorting in project
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/admin/groups_controller.rb | 3 | ||||
| -rw-r--r-- | app/controllers/admin/users_controller.rb | 4 | ||||
| -rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
| -rw-r--r-- | app/controllers/dashboard_controller.rb | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index ae610d4871c..65dc027c8eb 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -2,7 +2,8 @@ class Admin::GroupsController < Admin::ApplicationController before_filter :group, only: [:edit, :show, :update, :destroy, :project_update, :project_teams_update] def index - @groups = Group.order_name + @groups = Group.all + @groups = @groups.sort(@sort = params[:sort]) @groups = @groups.search(params[:name]) if params[:name].present? @groups = @groups.page(params[:page]).per(20) end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 932bfc777e6..e5d15528d78 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -2,10 +2,10 @@ class Admin::UsersController < Admin::ApplicationController before_filter :user, only: [:show, :edit, :update, :destroy] def index - @users = User.filter(params[:filter]) + @users = User.order_name_asc.filter(params[:filter]) @users = @users.search(params[:name]) if params[:name].present? @users = @users.sort(@sort = params[:sort]) - @users = @users.order_name.page(params[:page]) + @users = @users.page(params[:page]) end def show diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 36e13706768..6553027b430 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -254,7 +254,7 @@ class ApplicationController < ActionController::Base end def set_filters_params - params[:sort] ||= 'newest' + params[:sort] ||= 'created_desc' params[:scope] = 'all' if params[:scope].blank? params[:state] = 'opened' if params[:state].blank? @@ -280,7 +280,7 @@ class ApplicationController < ActionController::Base author_id = @filter_params[:author_id] milestone_id = @filter_params[:milestone_id] - @sort = @filter_params[:sort].try(:humanize) + @sort = @filter_params[:sort] @assignees = User.where(id: collection.pluck(:assignee_id)) @authors = User.where(id: collection.pluck(:author_id)) @milestones = Milestone.where(id: collection.pluck(:milestone_id)) diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index cd876024ba3..9e59264e418 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -9,7 +9,7 @@ class DashboardController < ApplicationController # If user needs more - point to Dashboard#projects page @projects_limit = 30 - @groups = current_user.authorized_groups.sort_by(&:human_name) + @groups = current_user.authorized_groups.order_name_asc @has_authorized_projects = @projects.count > 0 @projects_count = @projects.count @projects = @projects.limit(@projects_limit) |
