]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3046 the link 'More' must contain the selected period and severity
authorsimonbrandhof <simon.brandhof@gmail.com>
Wed, 7 Dec 2011 20:33:01 +0000 (21:33 +0100)
committersimonbrandhof <simon.brandhof@gmail.com>
Wed, 7 Dec 2011 20:33:01 +0000 (21:33 +0100)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/hotspots/hotspot_most_violated_rules.html.erb
sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb

index 5d894f5c21203adcdf7b2bd59e4f0aeaa9055bf2..0674eb1dc516d6d01778a6cdc05a7ff0c800f95f 100644 (file)
 
 <div class="line-block">
   <div style="float:right">
-    <a href="<%= url_for(:controller => 'drilldown', :action => 'violations', :id => @resource.key) -%>"><%= message('widget.hotspot_metric.more') -%></a>
+    <a href="#" onclick="window.location.href='<%= url_for(:controller => 'drilldown', :action => 'violations') -%>?id=<%= @resource.key -%>&period=<%= dashboard_configuration.period_index -%>&severity=' + $F('select-severity_<%= widget.id -%>') ">
+      <%= message('widget.hotspot_metric.more') -%>
+    </a>
   </div>
   <h3>
     <%= message(dashboard_configuration.selected_period? ? 'widget.hotspot_most_violated_rules.name_when_period' : 'widget.hotspot_most_violated_rules.name') -%>
 
-    <select class="small" style="margin-left: 20px" onchange="showMostViolatedRules<%= widget.id -%>(this.value);">
+    <select class="small" style="margin-left: 20px" onchange="showMostViolatedRules<%= widget.id -%>(this.value);" id="select-severity_<%= widget.id -%>">
       <option value="" <%= 'selected' if default_severity=='' -%>><%= message('widget.hotspot_most_violated_rules.any_severity') -%></option>
       <% Api::Severity::KEYS.each do |key| %>
         <option value="<%= key -%>" <%= 'selected' if default_severity==key -%>><%= message("severity.#{key}") -%></option>
index 3671f1dd71a5861560beb11d1815dfd148d0b0cc..87e7485f35671918c11f868a15c50519c73cb938 100644 (file)
@@ -80,7 +80,7 @@ class DrilldownController < ApplicationController
 
     @severity = params[:severity] || params[:priority]
     @rule_severity = params[:rule_sev] || @severity
-    if @rule_severity
+    if @rule_severity.present?
       # Filter resources by severity
       @metric = Metric::by_key("#{metric_prefix}#{@rule_severity.downcase}_violations")
     else
@@ -120,7 +120,7 @@ class DrilldownController < ApplicationController
     #
     # Initialize filter by rule
     #
-    if @severity
+    if @severity.present?
       # Filter on severity -> filter rule measures by the selected metric
       @rule_measures = @snapshot.rule_measures(@metric)
     else