From 9d5a2130d0a8c598497249be3f7169f546065b05 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 16 Dec 2011 14:12:44 +0100 Subject: [PATCH] SONAR-3101 "Duplications" tab shows incorrect lines --- .../_duplications_source_snippet.html.erb | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb index f16330e4fe4..02b4460950f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb @@ -1,48 +1,48 @@
- <% - if external - parent_project = resource.project - %> -

- <%= qualifier_icon(parent_project) -%> - <%= link_to_resource(parent_project, parent_project.path_name, {:dashboard => true}) -%> -    - <%= qualifier_icon(resource) -%> + <% + if external + parent_project = resource.project + %> +

+ <%= qualifier_icon(parent_project) -%> + <%= link_to_resource(parent_project, parent_project.path_name, {:dashboard => true}) -%> +    + <%= qualifier_icon(resource) -%> + <%= link_to_resource(resource, resource.name(true), {:line => from_line}) -%> + +

+ <% + else + %> +

+ <%= qualifier_icon(resource) -%> + <% if resource == original_resource %> + <%= resource.name(true) -%> + <% else %> <%= link_to_resource(resource, resource.name(true), {:line => from_line}) -%> - -

- <% - else - %> -

- <%= qualifier_icon(resource) -%> - <% if resource == original_resource %> - <%= resource.name(true) -%> - <% else %> - <%= link_to_resource(resource, resource.name(true), {:line => from_line}) -%> - <% end %> - -

- <% end %> + <% end %> + +

+ <% end %> <%= snapshot_source_to_html(resource.last_snapshot, {:line_range => from_line..to_line}) -%> - + <% if lines_count > 5 %> -

- <% - if to_line < from_line + lines_count - link_text = message('duplications.expand') - to_line = from_line + lines_count - else - link_text = message('duplications.collapse') - to_line = from_line + 5 - end - %> - <%= link_to_remote link_text, - :url => {:action => :show_duplication_snippet, :params => {:id => resource.id, :original_resource_id => original_resource.id, :from_line => from_line, :to_line => to_line, :lines_count => lines_count, :group_index => group_index}}, - :update => "source-#{group_index}", - :before => "$('expanding-#{group_index}').addClassName('loading')" -%> - -

+

+ <% + if to_line < from_line + lines_count + link_text = message('duplications.expand') + to_line = from_line + lines_count - 1 + else + link_text = message('duplications.collapse') + to_line = from_line + 5 + end + %> + <%= link_to_remote link_text, + :url => {:action => :show_duplication_snippet, :params => {:id => resource.id, :original_resource_id => original_resource.id, :from_line => from_line, :to_line => to_line, :lines_count => lines_count, :group_index => group_index}}, + :update => "source-#{group_index}", + :before => "$('expanding-#{group_index}').addClassName('loading')" -%> + +

<% end %>
\ No newline at end of file -- 2.39.5