diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-12-09 20:31:34 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-12-09 20:31:34 +0100 |
commit | a165e62535109185b709c37380c831e909b0bdee (patch) | |
tree | 784bf4a4e06b5c380f78e551746a922f723dc947 | |
parent | 459d96508f65f4122bf97e19caea4e1f88db1557 (diff) | |
download | sonarqube-a165e62535109185b709c37380c831e909b0bdee.tar.gz sonarqube-a165e62535109185b709c37380c831e909b0bdee.zip |
SONAR-3825 allow to unset the root project criteria
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb | 2 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 7a992b719b9..769eb22b4c0 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -610,6 +610,7 @@ module ApplicationHelper # * <tt>:resource_type_property</tt> -Filter on resource types on which the property is enabled, for example 'supportsGlobalDashboards'. # * <tt>:selected_resource</tt> - the resource that is selected by default. # * <tt>:placeholder</tt> - the label to display when nothing is selected + # * <tt>:allow_clear</tt> - true if resource can be de-selected. Default is false. # * <tt>:select2_options</tt> - hash of select2 options # def resource_select_tag(name, options={}) @@ -634,6 +635,7 @@ module ApplicationHelper min_length = 3 # see limitation in /api/resources/search js_options={ 'minimumInputLength' => min_length, + 'allowClear' => options[:allow_clear]||false, 'formatNoMatches' => "function(term){return '#{escape_javascript message('select2.noMatches')}'}", 'formatSearching' => "function(){return '#{escape_javascript message('select2.searching')}'}", 'formatInputTooShort' => "function(term, minLength){return '#{escape_javascript message('select2.tooShort', :params => [min_length])}'}" 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 120a4229536..fde61849113 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 @@ -93,7 +93,12 @@ <%= select_tag 'qualifiers[]', options_for_select(qualifiers, @filter.criteria['qualifiers']||''), :multiple => true, :id => 'select-qualifiers' -%> </li> <li id="criteria-project" <%= "style='display:none'" unless @filter.base_resource -%>> - <%= resource_select_tag 'baseId', :resource_type_property => 'supportsGlobalDashboards', :width => '100%', :selected_resource => @filter.base_resource, :placeholder => message('project'), :html_id => 'select-project' -%> + <%= resource_select_tag 'baseId', :resource_type_property => 'supportsGlobalDashboards', :width => '100%', + :selected_resource => @filter.base_resource, + :placeholder => message('project'), + :html_id => 'select-project', + :allow_clear => true + -%> </li> <li id="criteria-lang" <%= "style='display:none'" unless @filter.criteria('languages') -%>> <% languages = [['', '']].concat(Api::Utils.languages.map { |lang| [lang.name, lang.key] }) %> @@ -116,7 +121,7 @@ <% for i in 1..3 %> <li id="criteria-metric-<%= i -%>" style="<%= "display: none" if hidden_condition_indexes.include?(i) -%>"> <%= metric_select_tag "c#{i}_metric", condition_metrics, :allow_empty => true, :selected_key => @filter.criteria("c#{i}_metric"), :width => '100%', :placeholder => 'Metric' -%> - <%= select_tag "c#{i}_period", options_for_select([['Value', ''], ['Period 1', '1'], ['Period 2', '2'], ['Period 3', '3']], @filter.criteria("c#{i}_period")) -%> + <%= select_tag "c#{i}_period", options_for_select([['Value', ''], [Api::Utils.period_label(1), '1'], [Api::Utils.period_label(2), '2'], [Api::Utils.period_label(3), '3']], @filter.criteria("c#{i}_period")) -%> <br> <%= select_tag "c#{i}_op", options_for_select([['=', 'eq'], ['<', 'lt'], ['<=', 'lte'], ['>', 'gt'], ['>=', 'gte']], @filter.criteria("c#{i}_op")) -%> <input type="text" size="5" name="c<%= i -%>_val" value="<%= h @filter.criteria("c#{i}_val") -%>"> |