]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3392 Fixed case-sensitive sorting when listing permission templates
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Mon, 22 Jul 2013 13:47:34 +0000 (15:47 +0200)
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Mon, 22 Jul 2013 13:47:34 +0000 (15:47 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb

index 1457c3c0fe3916cb8d617f466dc36a76be311740..5b4b517a7a460e67e2a131c8b9f848332908e096 100644 (file)
@@ -184,7 +184,7 @@ class PermissionTemplatesController < ApplicationController
   def default_templates_form
     all_templates = Internal.permission_templates.selectAllPermissionTemplates
 
-    @permission_templates_options = all_templates.sort_by {|t| t.name}.collect {|t| [t.name, t.key]}
+    @permission_templates_options = all_templates.sort_by {|t| t.name.downcase}.collect {|t| [t.name, t.key]}
     @root_qualifiers = get_root_qualifiers
     @default_templates = get_default_templates_per_qualifier(@root_qualifiers)
 
@@ -228,7 +228,7 @@ class PermissionTemplatesController < ApplicationController
     templates_names.each do |template_name|
       permission_templates << Internal.permission_templates.selectPermissionTemplate(template_name)
     end
-    permission_templates.sort_by {|t| t.name}
+    permission_templates.sort_by {|t| t.name.downcase}
   end
 
 end
index 126d77112aee9403290ff80d1cf932ec1d24e823..c9db2eba7bb01017960d2b8a67131c5198e0e8db 100644 (file)
@@ -77,7 +77,7 @@ class RolesController < ApplicationController
 
   # GET /roles/apply_template_form?projects=<projects>&qualifier=<qualifier>
   def apply_template_form
-    @permission_templates = Internal.permission_templates.selectAllPermissionTemplates().sort_by {|t| t.name}.collect {|pt| [pt.name, pt.key]}
+    @permission_templates = Internal.permission_templates.selectAllPermissionTemplates().sort_by {|t| t.name.downcase}.collect {|pt| [pt.name, pt.key]}
     render :partial => 'apply_template_form', :locals => {:components => params[:projects], :project_name => params[:project_name], :qualifier => params[:qualifier] || 'TRK'}
   end