aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-09-17 10:21:45 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-09-17 10:21:45 +0200
commit8ed5b8943c5e6a6f3cfe15d0faee1083818084a2 (patch)
tree1736f295a1049c482af4043f3726e22b0841f809 /sonar-server
parentdb9fb5614189ae908d7e9e29b1632340afaeb56a (diff)
downloadsonarqube-8ed5b8943c5e6a6f3cfe15d0faee1083818084a2.tar.gz
sonarqube-8ed5b8943c5e6a6f3cfe15d0faee1083818084a2.zip
SONAR-4508 Order list of criteria on measures service
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/measures_helper.rb15
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb29
2 files changed, 16 insertions, 28 deletions
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 @@
</li>
<li id="more-td" class="marginbottom5">
- <select id="more-criteria">
- <option value=""></option>
- <% unless @filter.criteria('ageMinDays') || @filter.criteria('ageMaxDays') %>
- <option value="age"><%= message 'measure_filter.criteria.age' -%></option>
- <% end %>
- <% unless @filter.criteria('fromDate') || @filter.criteria('toDate') %>
- <option value="date"><%= message 'measure_filter.criteria.date' -%></option>
- <% end %>
- <% unless @filter.criteria('onFavourites') %>
- <option value="fav"><%= message 'measure_filter.criteria.only_favourites' -%></option>
- <% end %>
- <% unless @filter.criteria('keyRegexp') %>
- <option value="key"><%= message 'measure_filter.criteria.key' -%></option>
- <% end %>
- <% unless @filter.criteria('languages') %>
- <option value="lang"><%= message 'measure_filter.criteria.language' -%></option>
- <% end %>
- <option value="metric"><%= message 'measure_filter.criteria.metric' -%></option>
- <% unless @filter.criteria('nameSearch') %>
- <option value="name"><%= message 'measure_filter.criteria.name' -%></option>
- <% end %>
- <% unless @filter.base_resource %>
- <option value="project"><%= message 'measure_filter.criteria.components_of_project' -%></option>
- <% end %>
- <% unless @filter.criteria('alertLevels') %>
- <option value="alert"><%= message 'measure_filter.criteria.alert' -%></option>
- <% end %>
- </select>
+ <%= select_tag('more-criteria', options_for_select(more_criteria_options(@filter)), :id => 'more-criteria') -%>
</li>
<li>
<input type="submit" name="search" value="<%= message('search_verb') -%>" id="search-button">