]> source.dussan.org Git - redmine.git/commitdiff
'Assigned to' drop down list is now sorted by user's lastname.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 1 Dec 2007 17:42:26 +0000 (17:42 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 1 Dec 2007 17:42:26 +0000 (17:42 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@939 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb
app/models/query.rb
app/models/user.rb

index be46d6189f7a8b2ecf72a34a6404eae95c912d62..03ada035cbcc72bbf0f4eadc7ad1296febdfed50 100644 (file)
@@ -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
index 4cc5a63a5a20858412f8010a7cbdbc8e23ea4f51..4133abd8888a4f78d5f820fd14ccf5ce458ac430 100644 (file)
@@ -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] }
index 37512fda0494aa802e0a48c676641751a94f8fa0..737a8cc8edfe51ed5b95f1aeda311bf624344e0d 100644 (file)
@@ -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