Commit 519642af authored by barthc's avatar barthc

fix clickable code search results

parent fe32942f
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
.blob-result .blob-result
.file-holder .file-holder
.file-title .file-title
= link_to namespace_project_blob_path(@project.namespace, @project, tree_join(blob.ref, blob.filename), :anchor => "L" + blob.startline.to_s) do - blob_path = namespace_project_blob_path(@project.namespace, @project, tree_join(blob.ref, blob.filename))
= link_to blob_path do
%i.fa.fa-file %i.fa.fa-file
%strong %strong
= blob.filename = blob.filename
.file-content.code.term .file-content.code.term
= render 'shared/file_highlight', blob: blob, first_line_number: blob.startline = render 'shared/file_highlight', blob: blob, first_line_number: blob.startline, blob_path: blob_path
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
.line-numbers .line-numbers
- if blob.data.present? - if blob.data.present?
- link_icon = icon('link') - link_icon = icon('link')
- path = blob_path if defined?(blob_path)
- blob.data.each_line.each_with_index do |_, index| - blob.data.each_line.each_with_index do |_, index|
- offset = defined?(first_line_number) ? first_line_number : 1 - offset = defined?(first_line_number) ? first_line_number : 1
- i = index + offset - i = index + offset
-# We're not using `link_to` because it is too slow once we get to thousands of lines. -# We're not using `link_to` because it is too slow once we get to thousands of lines.
%a.diff-line-num{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i} %a.diff-line-num{href: "#{path}#L#{i}", id: "L#{i}", 'data-line-number' => i}
= link_icon = link_icon
= i = i
.blob-content{data: {blob_id: blob.id}} .blob-content{data: {blob_id: blob.id}}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment