From: Simon Brandhof Date: Tue, 27 Mar 2012 20:25:04 +0000 (+0200) Subject: SONAR-1569 Case sensitive sorting of components on the Dependencies page X-Git-Tag: 3.0~106 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ffcfb653091c0e2b148e51630d194b5e113131e2;p=sonarqube.git SONAR-1569 Case sensitive sorting of components on the Dependencies page --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dependencies_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dependencies_controller.rb index 904ce38b069..a3c03b63086 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dependencies_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dependencies_controller.rb @@ -42,13 +42,15 @@ class DependenciesController < ApplicationController # load all the resources (first column) # @resources=Project.find(:all, - :conditions => ["scope=? AND qualifier IN (?) AND enabled=? AND (UPPER(name) like ? OR kee like ?)", 'PRJ', QUALIFIERS, true, "%#{@search.upcase}%", "%#{@search}%"], :order => 'name') + :conditions => ["scope=? AND qualifier IN (?) AND enabled=? AND (UPPER(name) like ? OR kee like ?)", 'PRJ', QUALIFIERS, true, "%#{@search.upcase}%", "%#{@search}%"]) + Api::Utils.insensitive_sort!(@resources){|r| r.name} if params[:resource] @resource=@resources.select{|r| r.kee==params[:resource]}.first elsif @resources.size==1 @resource=@resources.first end + end if @resource @@ -85,7 +87,7 @@ class DependenciesController < ApplicationController project_sids=deps.map{|dep| dep.project_snapshot_id}.compact.uniq[0..950] # oracle issue with more than 1000 IN elements. Not annoying to truncate hundreds of results... if project_sids.size>0 @project_snapshots=Snapshot.find(:all, :include => 'project', :conditions => ['id IN (?) AND islast=? AND status=?', project_sids, true, 'P']) - @project_snapshots.sort! {|x,y| x.project.name <=> y.project.name } + Api::Utils.insensitive_sort!(@project_snapshots) {|s| s.project.name} else @project_snapshots=[] end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb index 286578434ae..0535341e2ca 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb @@ -1,7 +1,7 @@