From: Julien Lancelot Date: Tue, 17 Sep 2013 08:21:45 +0000 (+0200) Subject: SONAR-4508 Order list of criteria on measures service X-Git-Tag: 4.0~410 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8ed5b8943c5e6a6f3cfe15d0faee1083818084a2;p=sonarqube.git SONAR-4508 Order list of criteria on measures service --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb index 3607074a0b5..1e163184622 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb @@ -103,6 +103,21 @@ module MeasuresHelper [Api::Utils.period_label(1), Api::Utils.period_label(2), Api::Utils.period_label(3)] end + def more_criteria_options(filter) + more_criteria_options = [['', '']] + more_criteria_options << [message('measure_filter.criteria.metric'), 'metric'] + more_criteria_options << [message('measure_filter.criteria.age'), 'age'] unless filter.criteria('ageMinDays') || filter.criteria('ageMaxDays') + more_criteria_options << [message('measure_filter.criteria.date'), 'date'] unless filter.criteria('fromDate') || filter.criteria('toDate') + more_criteria_options << [message('measure_filter.criteria.only_favourites'), 'fav'] unless filter.criteria('onFavourites') + more_criteria_options << [message('measure_filter.criteria.key'), 'key'] unless filter.criteria('keyRegexp') + more_criteria_options << [message('measure_filter.criteria.language'), 'lang'] unless filter.criteria('languages') + more_criteria_options << [message('measure_filter.criteria.name'), 'name'] unless filter.criteria('nameSearch') + more_criteria_options << [message('measure_filter.criteria.components_of_project'), 'project'] unless filter.base_resource + more_criteria_options << [message('measure_filter.criteria.alert'), 'alert'] unless filter.criteria('alertLevels') + # SONAR-4508 sort criterias + Api::Utils.insensitive_sort(more_criteria_options){|option| option[0]} + end + private diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb index 0cb6b8124ca..c45af01a6fb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb @@ -198,34 +198,7 @@
  • - + <%= select_tag('more-criteria', options_for_select(more_criteria_options(@filter)), :id => 'more-criteria') -%>