summaryrefslogtreecommitdiff
path: root/app/views/projects/diffs/_parallel_view.html.haml
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/projects/diffs/_parallel_view.html.haml')
-rw-r--r--app/views/projects/diffs/_parallel_view.html.haml20
1 files changed, 14 insertions, 6 deletions
diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml
index f361204ecac..074f1f634ae 100644
--- a/app/views/projects/diffs/_parallel_view.html.haml
+++ b/app/views/projects/diffs/_parallel_view.html.haml
@@ -1,15 +1,17 @@
/ Side-by-side diff view
.text-file.diff-wrap-lines.code.js-syntax-highlight{ data: diff_view_data }
%table
- - last_line = 0
- diff_file.parallel_diff_lines.each do |line|
- left = line[:left]
- right = line[:right]
- - last_line = right.new_pos if right
%tr.line_holder.parallel
- if left
- - if left.meta?
+ - case left.type
+ - when 'match'
= diff_match_line left.old_pos, nil, text: left.text, view: :parallel
+ - when 'nonewline'
+ %td.old_line.diff-line-num
+ %td.line_content.match= left.text
- else
- left_line_code = diff_file.line_code(left)
- left_position = diff_file.position(left)
@@ -21,8 +23,12 @@
%td.line_content.parallel
- if right
- - if right.meta?
+ - case right.type
+ - when 'match'
= diff_match_line nil, right.new_pos, text: left.text, view: :parallel
+ - when 'nonewline'
+ %td.new_line.diff-line-num
+ %td.line_content.match= right.text
- else
- right_line_code = diff_file.line_code(right)
- right_position = diff_file.position(right)
@@ -37,5 +43,7 @@
- discussion_left, discussion_right = parallel_diff_discussions(left, right, diff_file)
- if discussion_left || discussion_right
= render "discussions/parallel_diff_discussion", discussion_left: discussion_left, discussion_right: discussion_right
- - if !diff_file.new_file && last_line > 0
- = diff_match_line last_line, last_line, bottom: true, view: :parallel
+ - if !diff_file.new_file && diff_file.diff_lines.any?
+ - last_line = diff_file.diff_lines.last
+ %tr.line_holder.parallel
+ = diff_match_line last_line.old_pos, last_line.new_pos, bottom: true, view: :parallel