From 3582904207a87f818846fbc7cce7c50d5194771f Mon Sep 17 00:00:00 2001 From: David Gageot Date: Fri, 5 Oct 2012 17:11:39 +0200 Subject: [PATCH] Sort properties by name --- .../src/main/webapp/WEB-INF/app/helpers/settings_helper.rb | 6 +++++- .../webapp/WEB-INF/app/views/settings/_properties.html.erb | 2 +- .../webapp/WEB-INF/app/views/settings/_settings.html.erb | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb index 857026a8042..1b7c36b12e8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb @@ -77,10 +77,14 @@ module SettingsHelper property.getType() end - def by_name(categories) + def by_category_name(categories) Api::Utils.insensitive_sort(categories) { |category| category_name(category) } end + def by_property_name(properties) + Api::Utils.insensitive_sort(properties) { |property| property_name(property) } + end + def input_name(property) name = "settings[#{h property.key}]" if property.multi_values diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb index b7713ed97fb..167143441ec 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb @@ -14,7 +14,7 @@ - <% @definitions.each do |property| -%> + <% by_property_name(@definitions).each do |property| -%>

diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_settings.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_settings.html.erb index db82d07cee7..46e7c6ea3d1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_settings.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_settings.html.erb @@ -11,7 +11,7 @@ - <% by_name(@categories).each do |category| -%> + <% by_category_name(@categories).each do |category| -%> <%= link_to category_name(category), :category => category -%> -- 2.39.5