diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss
index 502162325..f7e3ecbf9 100644
--- a/app/assets/stylesheets/design/custom.scss
+++ b/app/assets/stylesheets/design/custom.scss
@@ -1183,4 +1183,8 @@ table.tablesorter tr td.no_results {
.label-bootstrap.label-info.font14 a {
color: #FFFFFF;
+}
+
+.line_numbers a {
+ color: #999999;
}
\ No newline at end of file
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index e90e28b75..436371fcc 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -1,14 +1,18 @@
# -*- encoding : utf-8 -*-
module DiffHelper
- def render_diff(diff)
+ def render_diff(diff, diff_counter)
diff_display ||= Diff::Display::Unified.new(diff.diff)
-
+ path = if @pull
+ "#{polymorphic_path [@project, @pull]}/diff"
+ elsif @commit
+ "#{commit_path @project, @commit}"
+ end
#res = ""
res = "
"
res += ""
- res += diff_display.render(Git::Diff::InlineCallback.new)
+ res += diff_display.render(Git::Diff::InlineCallback.new(diff_counter, path))
res += ""
res += "
"
diff --git a/app/views/projects/git/commits/_commit_diff.html.haml b/app/views/projects/git/commits/_commit_diff.html.haml
index 4fd77215c..f95850f84 100644
--- a/app/views/projects/git/commits/_commit_diff.html.haml
+++ b/app/views/projects/git/commits/_commit_diff.html.haml
@@ -7,4 +7,4 @@
.r= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@project, commit_id, commit_diff.b_path)
.clear
- .diff_data= render_diff(commit_diff) unless (@git_repository.tree(commit_id) / commit_diff.b_path).binary?
\ No newline at end of file
+ .diff_data= render_diff(commit_diff, commit_diff_counter) unless (@git_repository.tree(commit_id) / commit_diff.b_path).binary?
\ No newline at end of file
diff --git a/app/views/projects/pull_requests/_pull_diff.html.haml b/app/views/projects/pull_requests/_pull_diff.html.haml
index 0a5a000c4..63bc04eb5 100644
--- a/app/views/projects/pull_requests/_pull_diff.html.haml
+++ b/app/views/projects/pull_requests/_pull_diff.html.haml
@@ -6,5 +6,4 @@
- if pull_diff.b_path.present?
.r= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@project, commit_id, pull_diff.b_path)
.clear
-
- .diff_data= render_diff(pull_diff) unless (Git::Repository.new(@pull.path).tree(commit_id) / pull_diff.b_path).binary?
+ .diff_data= render_diff(pull_diff, pull_diff_counter) unless (Git::Repository.new(@pull.path).tree(commit_id) / pull_diff.b_path).binary?
diff --git a/lib/ext/git/inline_callback.rb b/lib/ext/git/inline_callback.rb
index e57be6d65..37c55c2e0 100644
--- a/lib/ext/git/inline_callback.rb
+++ b/lib/ext/git/inline_callback.rb
@@ -2,6 +2,11 @@
module Git
module Diff
class InlineCallback < ::Diff::Renderer::Base
+ def initialize diff_counter, path
+ @diff_counter = diff_counter
+ @path = path
+ end
+
def before_headerblock(block)
end
@@ -17,33 +22,39 @@ module Git
end
def addline(line)
+ id = "F#{@diff_counter}R#{line.new_number}"
"
|
- #{line.new_number} |
+ #{line.new_number} |
#{render_line(line)} |
"
end
def remline(line)
+ id = "F#{@diff_counter}L#{line.old_number}"
"
- #{line.old_number} |
+ #{line.old_number} |
|
#{render_line(line)} |
"
end
def modline(line)
+ rid = "F#{@diff_counter}R#{line.new_number}"
+ lid = "F#{@diff_counter}L#{line.old_number}"
"
- #{line.old_number} |
- #{line.new_number} |
+ #{line.old_number} |
+ #{line.new_number} |
#{render_line(line)} |
"
end
def unmodline(line)
+ rid = "F#{@diff_counter}R#{line.new_number}"
+ lid = "F#{@diff_counter}L#{line.old_number}"
"
- #{line.old_number} |
- #{line.new_number} |
+ #{line.old_number} |
+ #{line.new_number} |
#{render_line(line)} |
"
end
@@ -57,9 +68,11 @@ module Git
end
def nonewlineline(line)
+ rid = "F#{@diff_counter}R#{line.new_number}"
+ lid = "F#{@diff_counter}L#{line.old_number}"
"
- #{line.old_number} |
- #{line.new_number} |
+ #{line.old_number} |
+ #{line.new_number} |
#{render_line(line)} |
"
end