]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4184 Use dropdown_tag component on violations drilldown period select box
authorJulien Lancelot <julien.lancelot@gmail.com>
Tue, 19 Mar 2013 15:19:46 +0000 (16:19 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Tue, 19 Mar 2013 15:19:46 +0000 (16:19 +0100)
sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb

index 023af0842081bbda39901dda36d2231e6e29ee92..0dc3f1ebb02f028fa52e93ef324267c10fc36b9e 100644 (file)
@@ -43,8 +43,8 @@ module DashboardHelper
   end
 
   def period_select_option_tags(snapshot, html_class = '')
-    options = ""
-    options = '<option selected="selected" value=""/>' unless params[:period]
+    selected=(!params[:period] || params[:period] == '0' ? 'selected' : '')
+    options = "<option #{selected} value='0' class='#{html_class}'/>#{message('time_changes')}...</option>"
     (1..5).each { |index|
       option = period_select_options(snapshot, index, html_class)
       if option
index ac410e4ba6b36262bbcf829568f054390f1cf398..949a7af315e637a83d778651e1defa137bf6776e 100644 (file)
@@ -22,7 +22,6 @@
             <input type="hidden" name="did" value="<%= @dashboard.id -%>"/>
             <%= dropdown_tag "period", period_select_option_tags(@snapshot, 'small'), {
                 :width => '200px',
-                :placeholder => message('time_changes') + '...'
             }, {:id => 'select-comparison', :onchange => 'submit()'} -%>
           </form>
         <% end %>
index b908a8f18baf5993b117c0d283248c3d81a8753b..636d3d73fca4f6080946a1de2aa08a7553f2402e 100644 (file)
@@ -1,25 +1,22 @@
 <%= render :partial => 'header' -%>
 
-<div id="snapshot_title" class="page_title">
-  <h4>
-    <%
-       profile_measure=@snapshot.measure(Metric::PROFILE)
-    %>
-    <% if profile_measure %>Profile <%= link_to profile_measure.data, :controller => '/rules_configuration', :action => 'index', :id => profile_measure.value.to_i %> -
-    <% end %>
-    <% if @snapshot.project_snapshot.periods? %>
-      <form method="GET" action="<%= url_for :only_path=>true, :overwrite_params => {:period => nil} -%>" style="display: inline">
-        <select id="select-comparison" name="period" onchange="submit()" class="small">
-          <option value=""><%= message('time_changes') -%>...</option>
-          <%= violation_period_select_options(@snapshot, 1) -%>
-          <%= violation_period_select_options(@snapshot, 2) -%>
-          <%= violation_period_select_options(@snapshot, 3) -%>
-          <%= violation_period_select_options(@snapshot, 4) -%>
-          <%= violation_period_select_options(@snapshot, 5) -%>
-        </select>
-      </form>
-    <% end %>
-  </h4>
+<div class="line-block">
+  <div id="snapshot_title" class="page_title">
+    <h4>
+      <%
+         profile_measure=@snapshot.measure(Metric::PROFILE)
+      %>
+      <% if profile_measure %>Profile <%= link_to profile_measure.data, :controller => '/rules_configuration', :action => 'index', :id => profile_measure.value.to_i %>
+      <% end %>
+      <% if @snapshot.project_snapshot.periods? %>
+        <form method="GET" action="<%= url_for :only_path=>true, :overwrite_params => {:period => nil} -%>" style="display: inline" class="spacer-left">
+          <%= dropdown_tag "period", period_select_option_tags(@snapshot, 'small'), {
+              :width => '200px',
+          }, {:id => 'select-comparison', :onchange => 'submit()'} -%>
+        </form>
+      <% end %>
+    </h4>
+  </div>
 </div>
 
 <table class="width100 spacer-bottom" cellpadding="0" cellspacing="0" id="columns">