<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}) -%>
-
- <%= 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}) -%>
+
+ <%= 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