summaryrefslogtreecommitdiff
path: root/app/views/projects/diffs/_parallel_view.html.haml
diff options
context:
space:
mode:
authorRubén Dávila <Ruben@GitLab.com>2015-12-15 18:09:09 -0500
committerRubén Dávila <rdavila84@gmail.com>2015-12-28 18:31:27 -0500
commit34657b821ae597de76ffd5a70d2b0b298dc270ed (patch)
treeb1aa6974c5631b0df71e5640329212216aeb10cf /app/views/projects/diffs/_parallel_view.html.haml
parent3a227b5abb0c794e95dd9153e3616c5d81aa06f8 (diff)
downloadgitlab-ce-34657b821ae597de76ffd5a70d2b0b298dc270ed.tar.gz
Add syntax highlighting to diff view. #3945
Diffstat (limited to 'app/views/projects/diffs/_parallel_view.html.haml')
-rw-r--r--app/views/projects/diffs/_parallel_view.html.haml8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml
index 37fd1b1ec8a..c6a9d71e789 100644
--- a/app/views/projects/diffs/_parallel_view.html.haml
+++ b/app/views/projects/diffs/_parallel_view.html.haml
@@ -1,5 +1,5 @@
/ Side-by-side diff view
-%div.text-file.diff-wrap-lines
+%div.text-file.diff-wrap-lines.code.file-content.js-syntax-highlight{ class: user_color_scheme }
%table
- parallel_diff(diff_file, index).each do |line|
- type_left = line[0]
@@ -20,7 +20,8 @@
= link_to raw(line_number_left), "##{line_code_left}", id: line_code_left
- if @comments_allowed && can?(current_user, :create_note, @project)
= link_to_new_diff_note(line_code_left, 'old')
- %td.line_content{class: "parallel noteable_line #{type_left} #{line_code_left}", "line_code" => line_code_left }= raw line_content_left
+ %td.line_content{class: "parallel noteable_line #{type_left} #{line_code_left}", "line_code" => line_code_left }<
+ = highlight_line(diff_file.new_path, unescape_html(line_content_left))
- if type_right == 'new'
- new_line_class = 'new'
@@ -33,7 +34,8 @@
= link_to raw(line_number_right), "##{new_line_code}", id: new_line_code
- if @comments_allowed && can?(current_user, :create_note, @project)
= link_to_new_diff_note(line_code_right, 'new')
- %td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", "line_code" => new_line_code}= raw line_content_right
+ %td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", "line_code" => new_line_code}<
+ = highlight_line(diff_file.new_path, unescape_html(line_content_right))
- if @reply_allowed
- comments_left, comments_right = organize_comments(type_left, type_right, line_code_left, line_code_right)