From 81ada666bb54eeb26c207284e6369f371bb9147a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 1 Dec 2007 17:42:26 +0000 Subject: [PATCH] 'Assigned to' drop down list is now sorted by user's lastname. git-svn-id: http://redmine.rubyforge.org/svn/trunk@939 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/project.rb | 2 +- app/models/query.rb | 2 +- app/models/user.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index be46d6189..03ada035c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -132,7 +132,7 @@ class Project < ActiveRecord::Base # Users issues can be assigned to def assignable_users - members.select {|m| m.role.assignable?}.collect {|m| m.user} + members.select {|m| m.role.assignable?}.collect {|m| m.user}.sort end # Returns the mail adresses of users that should be always notified on project events diff --git a/app/models/query.rb b/app/models/query.rb index 4cc5a63a5..4133abd88 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -147,7 +147,7 @@ class Query < ActiveRecord::Base user_values = [] user_values << ["<< #{l(:label_me)} >>", "me"] if executed_by if project - user_values += project.users.collect{|s| [s.name, s.id.to_s] } + user_values += project.users.sort.collect{|s| [s.name, s.id.to_s] } elsif executed_by # members of the user's projects user_values += executed_by.projects.collect(&:users).flatten.uniq.sort.collect{|s| [s.name, s.id.to_s] } diff --git a/app/models/user.rb b/app/models/user.rb index 37512fda0..737a8cc8e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -163,7 +163,7 @@ class User < ActiveRecord::Base end def <=>(user) - lastname == user.lastname ? firstname <=> user.firstname : lastname <=> user.lastname + user.nil? ? -1 : (lastname == user.lastname ? firstname <=> user.firstname : lastname <=> user.lastname) end def to_s -- 2.39.5