aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-12-16 14:12:44 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2011-12-16 14:12:44 +0100
commit9d5a2130d0a8c598497249be3f7169f546065b05 (patch)
tree7524931c41b299cf65c919772a6c4ab8b20752b8
parent581398901c5763b39c01ee194a69850e90e7b63b (diff)
downloadsonarqube-9d5a2130d0a8c598497249be3f7169f546065b05.tar.gz
sonarqube-9d5a2130d0a8c598497249be3f7169f546065b05.zip
SONAR-3101 "Duplications" tab shows incorrect lines
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications_source_snippet.html.erb82
1 files 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 @@
<div class="<%= 'expanded' if to_line == from_line + lines_count -%>">
- <%
- if external
- parent_project = resource.project
- %>
- <p>
- <%= qualifier_icon(parent_project) -%>
- <%= link_to_resource(parent_project, parent_project.path_name, {:dashboard => true}) -%>
- &nbsp;&nbsp;
- <%= qualifier_icon(resource) -%>
+ <%
+ if external
+ parent_project = resource.project
+ %>
+ <p>
+ <%= qualifier_icon(parent_project) -%>
+ <%= link_to_resource(parent_project, parent_project.path_name, {:dashboard => true}) -%>
+ &nbsp;&nbsp;
+ <%= qualifier_icon(resource) -%>
+ <%= link_to_resource(resource, resource.name(true), {:line => from_line}) -%>
+ <span id="duplLoading-<%= group_index -%>"></span>
+ </p>
+ <%
+ else
+ %>
+ <p>
+ <%= qualifier_icon(resource) -%>
+ <% if resource == original_resource %>
+ <%= resource.name(true) -%>
+ <% else %>
<%= link_to_resource(resource, resource.name(true), {:line => from_line}) -%>
- <span id="duplLoading-<%= group_index -%>"></span>
- </p>
- <%
- else
- %>
- <p>
- <%= qualifier_icon(resource) -%>
- <% if resource == original_resource %>
- <%= resource.name(true) -%>
- <% else %>
- <%= link_to_resource(resource, resource.name(true), {:line => from_line}) -%>
- <% end %>
- <span id="duplLoading-<%= group_index -%>"></span>
- </p>
- <% end %>
+ <% end %>
+ <span id="duplLoading-<%= group_index -%>"></span>
+ </p>
+ <% end %>
<%= snapshot_source_to_html(resource.last_snapshot, {:line_range => from_line..to_line}) -%>
-
+
<% if lines_count > 5 %>
- <p class="small">
- <%
- 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')" -%>
- <span id="expanding-<%= group_index -%>"></span>
- </p>
+ <p class="small">
+ <%
+ 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')" -%>
+ <span id="expanding-<%= group_index -%>"></span>
+ </p>
<% end %>
</div> \ No newline at end of file