2013-11-27 03:00:14 -05:00
|
|
|
/ Side-by-side diff view
|
2016-10-22 20:42:36 -04:00
|
|
|
%div.text-file.diff-wrap-lines.code.js-syntax-highlight{ data: diff_view_data }
|
2014-04-24 04:49:01 -04:00
|
|
|
%table
|
2016-07-21 14:44:12 -04:00
|
|
|
- last_line = 0
|
2016-01-20 08:51:56 -05:00
|
|
|
- diff_file.parallel_diff_lines.each do |line|
|
2016-01-14 08:52:08 -05:00
|
|
|
- left = line[:left]
|
|
|
|
- right = line[:right]
|
2016-07-21 14:44:12 -04:00
|
|
|
- last_line = right.new_pos if right
|
2016-07-01 01:09:56 -04:00
|
|
|
%tr.line_holder.parallel
|
2016-07-20 18:18:18 -04:00
|
|
|
- if left
|
|
|
|
- if left.meta?
|
2016-07-21 14:44:12 -04:00
|
|
|
= diff_match_line left.old_pos, nil, text: left.text, view: :parallel
|
2016-07-20 18:18:18 -04:00
|
|
|
- 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-14 08:52:08 -05:00
|
|
|
- else
|
2016-07-20 18:18:18 -04:00
|
|
|
%td.old_line.diff-line-num.empty-cell
|
|
|
|
%td.line_content.parallel
|
2014-09-12 12:43:44 -04:00
|
|
|
|
2016-07-20 18:18:18 -04:00
|
|
|
- if right
|
|
|
|
- if right.meta?
|
2016-07-21 14:44:12 -04:00
|
|
|
= diff_match_line nil, right.new_pos, text: left.text, view: :parallel
|
2014-09-12 12:43:44 -04:00
|
|
|
- else
|
2016-07-20 18:18:18 -04:00
|
|
|
- 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
|
2014-09-12 12:43:44 -04:00
|
|
|
|
2016-05-13 15:53:04 -04:00
|
|
|
- unless @diff_notes_disabled
|
2016-07-20 18:18:18 -04:00
|
|
|
- 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
|
2016-07-21 14:44:12 -04:00
|
|
|
- if !diff_file.new_file && last_line > 0
|
|
|
|
= diff_match_line last_line, last_line, bottom: true, view: :parallel
|