]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2369 User list is not correctly sorted in the Groups page
authorsimonbrandhof <simon.brandhof@gmail.com>
Wed, 27 Apr 2011 10:41:44 +0000 (12:41 +0200)
committersimonbrandhof <simon.brandhof@gmail.com>
Wed, 27 Apr 2011 10:41:44 +0000 (12:41 +0200)
sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/models/group.rb
sonar-server/src/main/webapp/WEB-INF/app/models/user.rb
sonar-server/src/main/webapp/WEB-INF/app/views/groups/select_user.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb

index c8b9cb1b4731f0c477050c6ccdca5287bfcb7809..b83228c3c03c854ba7281b32fa1919429ff963dc 100644 (file)
@@ -26,7 +26,7 @@ module RolesHelper
   end
 
   def all_users
-    User.find(:all, :order => 'login')
+    User.find(:all, :order => 'name')
   end
 
   def groups(role, resource_id=nil)
index ba62292961318c2dc734c6aac175eb720921946f..3acfda55b1ab3bd8bbbb4fc10b6c184ca64858cf 100644 (file)
@@ -29,13 +29,13 @@ class Group < ActiveRecord::Base
 
   # all the users that are NOT members of this group
   def available_users
-    User.all - users
+    User.find(:all, :order => 'name') - users
   end
 
   def set_users(new_users=[])
     self.users.clear
     
-    new_users=(new_users || []).compact.uniq
+    new_users=(new_users||[]).compact.uniq
     self.users = User.find(new_users)
     save
   end
index 9176f859763ca23813686803b14b88576b4eb319..69bf41d343fac3f7ad8386943573bf7bf2bc8ac7 100644 (file)
@@ -78,7 +78,7 @@ class User < ActiveRecord::Base
   end
 
   def <=>(other)
-    login<=>other.login
+    name<=>other.name
   end
 
 
index f96a1e0d906db05ff868800bad87c2757109b8a1..0a162f38161c6d6986be3cde488738d958b0a6dd 100644 (file)
@@ -11,7 +11,7 @@
           <td style="padding: 5px 0pt;" valign="top">
             <h2>Non-members</h2>
             <select name="from" id="from" size="10" style="margin: 5px 0pt; width: 300px;" multiple="multiple">
-              <% @group.available_users.each do |user| %>
+              <% @group.available_users.sort.each do |user| %>
                 <option value="<%= user.id -%>"><%= user.login %></option>
               <% end %>
             </select>
@@ -26,7 +26,7 @@
             <h2>Members</h2>
 
             <select name="users[]" id="to" size="10" multiple="multiple" style="margin: 5px 0pt; width: 300px;">
-              <%= options_from_collection_for_select(@group.users, "id", "login") %>
+              <%= options_from_collection_for_select(@group.users.sort, "id", "login") %>
             </select><br>
 
             <div style="padding: 5px 0pt;">
index 2132abc7896a47fd699612bde7b2f299f6f7e7fc..7882fe88bb3479e08bb86bdc9e2997615a33bd55 100644 (file)
@@ -1,6 +1,6 @@
 <%
   granted_users=users(@role, params[:resource])
-  ungranted_users=all_users - granted_users
+  ungranted_users=(all_users - granted_users)
   if @project
      title=h(@project.name)
    elsif @role.starts_with?('default-')