From: Jean-Philippe Lang Date: Sat, 1 Dec 2007 17:42:26 +0000 (+0000) Subject: 'Assigned to' drop down list is now sorted by user's lastname. X-Git-Tag: 0.6.1~28 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=81ada666bb54eeb26c207284e6369f371bb9147a;p=redmine.git '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 --- 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