From a9c1b85e08e7e6ed1f209b8a5e2b43ea3b91dbb4 Mon Sep 17 00:00:00 2001 From: Dmitry Moskalchuk Date: Sat, 16 Feb 2013 19:40:33 +0400 Subject: [PATCH] Sort groups/namespaces by human name --- app/controllers/dashboard_controller.rb | 2 +- app/helpers/namespaces_helper.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 098b1cbb..865c0601 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -5,7 +5,7 @@ class DashboardController < ApplicationController before_filter :event_filter, only: :show def show - @groups = current_user.authorized_groups.sort_by { |x| x.name } + @groups = current_user.authorized_groups.sort_by { |x| x.human_name } @has_authorized_projects = @projects.count > 0 @teams = current_user.authorized_teams @projects_count = @projects.count diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index 6d0c6c98..b1985188 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -10,8 +10,8 @@ module NamespacesHelper global_opts = ["Global", [['/', Namespace.global_id]] ] - group_opts = ["Groups", groups.map {|g| [g.human_name, g.id]} ] - users_opts = [ "Users", users.map {|u| [u.human_name, u.id]} ] + group_opts = ["Groups", groups.sort_by {|g| g.human_name}.map {|g| [g.human_name, g.id]} ] + users_opts = [ "Users", users.sort_by {|u| u.human_name}.map {|u| [u.human_name, u.id]} ] options = [] options << global_opts if current_user.admin