]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-968 Highlight lowest level in resource explorer when selected
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Fri, 28 Sep 2012 11:20:47 +0000 (13:20 +0200)
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Fri, 28 Sep 2012 12:51:40 +0000 (14:51 +0200)
sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb

index c3848b0c1ed2490279c9b877c446a3ece0d9e354..5e0f823f38101367e618ebf8f3e6e9595c058ee4 100644 (file)
     <td class="<%= 'spacer-left' unless first_column -%>" nowrap>
       <div class="scrollable" id="col_<%= index -%>">
         <table class="spaced">
-          <% column.measures.each do |measure|
+          <% column.measures.each_with_index do |measure, row_index|
             resource=column.resource(measure)
             selected = column.selected_snapshot && column.selected_snapshot.project_id==resource.id
             clazz = cycle("even", "odd", :name => "col_#{index}")
             clazz = clazz + ' selected' if selected
           %>
-            <tr class="<%= clazz -%>">
+            <tr class="<%= clazz -%>" id="row_<%= index -%>_<%= row_index -%>">
               <td nowrap>
                 <% unless resource.source_code? %>
                   <%= link_to(image_tag('zoom.png'), {:id => resource.id, :metric => @metric.id}, {:class => 'nolink'}) -%>
                 <% end %>
                 <%= qualifier_icon(resource) -%>&nbsp;
                 <% if resource.source_code? %>
-                  <a href="#" onclick="d(<%= resource.id -%>)" alt="<%= resource.name(true) -%>" title="<%= resource.name(true) -%>"><%= resource.name(false) -%></a>
+                  <a href="#" onclick="$$('#col_<%= index -%> tr').invoke('removeClassName', 'selected'); $('row_<%= index -%>_<%= row_index -%>').addClassName('selected'); d(<%= resource.id -%>)" 
+                     alt="<%= resource.name(true) -%>" title="<%= resource.name(true) -%>"><%= resource.name(false) -%></a>
                 <% else %>
                   <%= link_to(resource.name, {:only_path => true, :overwrite_params => {:rids => (selected ? rids-[resource.id] : rids+[resource.id])}}) -%>
                 <% end %>
index b79d399a1d1b30ace3c08c5813f7890208262cbe..2a44c0e730ce04964748bc653b1fc80b06023394 100644 (file)
     <div class="scrollable" id="col_<%= index -%>">
       <table class="spaced">
         <%
-           column.measures.each do |measure|
+           column.measures.each_with_index do |measure, row_index|
              resource=column.resource(measure)
              clazz = cycle('even', 'odd', :name => "col_#{index}")
              selected = column.selected_snapshot && column.selected_snapshot.project_id==resource.id
                paths << [h(resource.name), @selected_rids-[resource.id]]
              end
         %>
-          <tr class="<%= clazz -%>">
+          <tr class="<%= clazz -%>" id="row_<%= index -%>_<%= row_index -%>">
             <td nowrap>
               <% unless resource.source_code? %>
                 <%= link_to(image_tag('zoom.png'), {:id => resource.id}, {:class => 'nolink'}) %>
               <% end %>
               <%= qualifier_icon(resource) -%>&nbsp;
               <% if resource.source_code? %>
-                <a href="#" onclick="d(<%= resource.id -%>, '<%= @period_index -%>', '<%= @rule ? @rule.key : @severity -%>');" alt="<%= resource.name(true) -%>" title="<%= resource.name(true) -%>"><%= resource.name(false) %></a>
+                <a href="#" onclick="$$('#col_<%= index -%> tr').invoke('removeClassName', 'selected'); $('row_<%= index -%>_<%= row_index -%>').addClassName('selected'); d(<%= resource.id -%>, '<%= @period_index -%>', '<%= @rule ? @rule.key : @severity -%>');" 
+                   alt="<%= resource.name(true) -%>" title="<%= resource.name(true) -%>"><%= resource.name(false) %></a>
               <% else %>
                 <%= link_to(h(resource.name), {:only_path => true, :overwrite_params => {:rids => (selected ? rids-[resource.id] : rids+[resource.id])}}) -%>
               <% end %>