diff options
author | Fabrice Bellingard <fabrice.bellingard@sonarsource.com> | 2013-01-22 17:35:59 +0100 |
---|---|---|
committer | Fabrice Bellingard <fabrice.bellingard@sonarsource.com> | 2013-01-22 17:39:35 +0100 |
commit | d183f4137b377ca508ded6ba35fe4c98665849b7 (patch) | |
tree | 0fdedd562b402999db42f9508de03555823ff4cf | |
parent | f9d11be93d298aa29d2782f1778971c02ab86d6d (diff) | |
download | sonarqube-d183f4137b377ca508ded6ba35fe4c98665849b7.tar.gz sonarqube-d183f4137b377ca508ded6ba35fe4c98665849b7.zip |
SONAR-4088 Sort available widgets by name when editing a dashboard
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb index 5d570c4964a..8ad90815c07 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb @@ -189,11 +189,15 @@ class DashboardController < ApplicationController end def load_widget_definitions(filter_on_category) - @widget_definitions=java_facade.getWidgets() - + @widget_definitions=java_facade.getWidgets().sort {|w1,w2| widgetL10nName(w1) <=> widgetL10nName(w2)} + @widget_categories=@widget_definitions.map(&:getWidgetCategories).flatten.uniq.sort unless filter_on_category.blank? @widget_definitions=@widget_definitions.select { |definition| definition.getWidgetCategories().to_a.include?(filter_on_category) } end end + + def widgetL10nName(widget) + Api::Utils.message('widget.' + widget.id + '.name') + end end |