2015-04-26 12:48:37 +05:30
|
|
|
/ Side-by-side diff view
|
2016-11-03 12:29:30 +05:30
|
|
|
%div.text-file.diff-wrap-lines.code.js-syntax-highlight{ data: diff_view_data }
|
2015-04-26 12:48:37 +05:30
|
|
|
%table
|
2016-09-13 17:45:13 +05:30
|
|
|
- last_line = 0
|
2016-01-29 22:53:50 +05:30
|
|
|
- diff_file.parallel_diff_lines.each do |line|
|
|
|
|
- left = line[:left]
|
|
|
|
- right = line[:right]
|
2016-09-13 17:45:13 +05:30
|
|
|
- last_line = right.new_pos if right
|
2015-04-26 12:48:37 +05:30
|
|
|
%tr.line_holder.parallel
|
2016-09-13 17:45:13 +05:30
|
|
|
- if left
|
|
|
|
- if left.meta?
|
|
|
|
= diff_match_line left.old_pos, nil, text: left.text, view: :parallel
|
|
|
|
- else
|
|
|
|
- left_line_code = diff_file.line_code(left)
|
|
|
|
- left_position = diff_file.position(left)
|
|
|
|
%td.old_line.diff-line-num{id: left_line_code, class: left.type, data: { linenumber: left.old_pos }}
|
|
|
|
%a{href: "##{left_line_code}" }= raw(left.old_pos)
|
|
|
|
%td.line_content.parallel.noteable_line{class: left.type, data: diff_view_line_data(left_line_code, left_position, 'old')}= diff_line_content(left.text)
|
2016-01-29 22:53:50 +05:30
|
|
|
- else
|
2016-09-13 17:45:13 +05:30
|
|
|
%td.old_line.diff-line-num.empty-cell
|
|
|
|
%td.line_content.parallel
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
- if right
|
|
|
|
- if right.meta?
|
|
|
|
= diff_match_line nil, right.new_pos, text: left.text, view: :parallel
|
2015-04-26 12:48:37 +05:30
|
|
|
- else
|
2016-09-13 17:45:13 +05:30
|
|
|
- right_line_code = diff_file.line_code(right)
|
|
|
|
- right_position = diff_file.position(right)
|
|
|
|
%td.new_line.diff-line-num{id: right_line_code, class: right.type, data: { linenumber: right.new_pos }}
|
|
|
|
%a{href: "##{right_line_code}" }= raw(right.new_pos)
|
|
|
|
%td.line_content.parallel.noteable_line{class: right.type, data: diff_view_line_data(right_line_code, right_position, 'new')}= diff_line_content(right.text)
|
|
|
|
- else
|
|
|
|
%td.old_line.diff-line-num.empty-cell
|
|
|
|
%td.line_content.parallel
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
- unless @diff_notes_disabled
|
2016-09-13 17:45:13 +05:30
|
|
|
- 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
|