2013-11-27 03:00:14 -05:00
|
|
|
/ Side-by-side diff view
|
2016-01-07 13:45:19 -05:00
|
|
|
%div.text-file.diff-wrap-lines.code.file-content.js-syntax-highlight
|
2014-04-24 04:49:01 -04:00
|
|
|
%table
|
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]
|
2014-09-12 12:43:44 -04:00
|
|
|
%tr.line_holder.parallel
|
2016-01-14 08:52:08 -05:00
|
|
|
- if left[:type] == 'match'
|
|
|
|
= render "projects/diffs/match_line_parallel", { line: left[:text],
|
|
|
|
line_old: left[:number], line_new: right[:number] }
|
2016-01-20 13:20:13 -05:00
|
|
|
- elsif left[:type] == 'nonewline'
|
2016-01-21 08:23:53 -05:00
|
|
|
%td.old_line.diff-line-num
|
|
|
|
%td.line_content.parallel.match= left[:text]
|
|
|
|
%td.new_line.diff-line-num
|
|
|
|
%td.line_content.parallel.match= left[:text]
|
2016-01-14 08:52:08 -05:00
|
|
|
- else
|
2016-04-11 08:19:55 -04:00
|
|
|
%td.old_line.diff-line-num{id: left[:line_code], class: "#{left[:type]} #{'empty-cell' if !left[:number]}"}
|
2016-01-14 08:52:08 -05:00
|
|
|
= link_to raw(left[:number]), "##{left[:line_code]}", id: left[:line_code]
|
2015-06-26 09:55:56 -04:00
|
|
|
- if @comments_allowed && can?(current_user, :create_note, @project)
|
2016-01-14 08:52:08 -05:00
|
|
|
= link_to_new_diff_note(left[:line_code], 'old')
|
2016-04-11 08:19:55 -04:00
|
|
|
%td.line_content{class: "parallel noteable_line #{left[:type]} #{left[:line_code]} #{'empty-cell' if left[:text].empty?}", data: { line_code: left[:line_code] }}= diff_line_content(left[:text])
|
2014-09-12 12:43:44 -04:00
|
|
|
|
2016-01-14 08:52:08 -05:00
|
|
|
- if right[:type] == 'new'
|
2014-09-12 12:43:44 -04:00
|
|
|
- new_line_class = 'new'
|
2016-01-14 08:52:08 -05:00
|
|
|
- new_line_code = right[:line_code]
|
2014-09-12 12:43:44 -04:00
|
|
|
- else
|
|
|
|
- new_line_class = nil
|
2016-01-14 08:52:08 -05:00
|
|
|
- new_line_code = left[:line_code]
|
2014-09-12 12:43:44 -04:00
|
|
|
|
2016-04-11 08:19:55 -04:00
|
|
|
%td.new_line.diff-line-num{id: new_line_code, class: "#{new_line_class} #{'empty-cell' if !right[:number]}", data: { linenumber: right[:number] }}
|
2016-01-14 08:52:08 -05:00
|
|
|
= link_to raw(right[:number]), "##{new_line_code}", id: new_line_code
|
2015-06-26 09:55:56 -04:00
|
|
|
- if @comments_allowed && can?(current_user, :create_note, @project)
|
2016-05-10 18:41:46 -04:00
|
|
|
= link_to_new_diff_note(new_line_code, 'new')
|
2016-04-11 08:19:55 -04:00
|
|
|
%td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code} #{'empty-cell' if right[:text].empty?}", data: { line_code: new_line_code }}= diff_line_content(right[:text])
|
2014-09-12 12:43:44 -04:00
|
|
|
|
2016-05-10 18:41:46 -04:00
|
|
|
- if @comments_allowed
|
|
|
|
- notes_left, notes_right = organize_comments(left, right)
|
|
|
|
- if notes_left.present? || notes_right.present?
|
|
|
|
= render "projects/notes/diff_notes_with_reply_parallel", notes_left: notes_left, notes_right: notes_right
|
2014-09-04 06:05:58 -04:00
|
|
|
|
2014-09-08 09:26:49 -04:00
|
|
|
- if diff_file.diff.diff.blank? && diff_file.mode_changed?
|
2014-09-04 06:05:58 -04:00
|
|
|
.file-mode-changed
|
|
|
|
File mode changed
|