From: Simon Brandhof Date: Sun, 9 Dec 2012 19:31:34 +0000 (+0100) Subject: SONAR-3825 allow to unset the root project criteria X-Git-Tag: 3.4~89 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a165e62535109185b709c37380c831e909b0bdee;p=sonarqube.git SONAR-3825 allow to unset the root project criteria --- 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 # * :resource_type_property -Filter on resource types on which the property is enabled, for example 'supportsGlobalDashboards'. # * :selected_resource - the resource that is selected by default. # * :placeholder - the label to display when nothing is selected + # * :allow_clear - true if resource can be de-selected. Default is false. # * :select2_options - 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' -%>
  • > - <%= 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 + -%>
  • > <% languages = [['', '']].concat(Api::Utils.languages.map { |lang| [lang.name, lang.key] }) %> @@ -116,7 +121,7 @@ <% for i in 1..3 %>
  • "> <%= 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")) -%>
    <%= select_tag "c#{i}_op", options_for_select([['=', 'eq'], ['<', 'lt'], ['<=', 'lte'], ['>', 'gt'], ['>=', 'gte']], @filter.criteria("c#{i}_op")) -%> ">