gitlab-org--gitlab-foss/app/views/projects/diffs/_parallel_view.html.haml

44 lines
2.2 KiB
Text
Raw Normal View History

2013-11-27 03:00:14 -05:00
/ Side-by-side diff view
%div.text-file.diff-wrap-lines.code.file-content.js-syntax-highlight
%table
- diff_file.parallel_diff_lines.each do |line|
- left = line[:left]
- right = line[:right]
2014-09-12 12:43:44 -04:00
%tr.line_holder.parallel
- if left[:type] == 'match'
= render "projects/diffs/match_line_parallel", { line: left[:text],
line_old: left[:number], line_new: right[:number] }
- elsif left[:type] == 'nonewline'
%td.old_line
%td.line_content.parallel.matched= left[:text]
%td.new_line
%td.line_content.parallel.matched= left[:text]
- else
%td.old_line{id: left[:line_code], class: "#{left[:type]}"}
= link_to raw(left[:number]), "##{left[:line_code]}", id: left[:line_code]
- if @comments_allowed && can?(current_user, :create_note, @project)
= link_to_new_diff_note(left[:line_code], 'old')
%td.line_content{class: "parallel noteable_line #{left[:type]} #{left[:line_code]}", data: { line_code: left[:line_code] }}= diff_line_content(left[:text])
2014-09-12 12:43:44 -04:00
- if right[:type] == 'new'
2014-09-12 12:43:44 -04:00
- new_line_class = 'new'
- new_line_code = right[:line_code]
2014-09-12 12:43:44 -04:00
- else
- new_line_class = nil
- new_line_code = left[:line_code]
2014-09-12 12:43:44 -04:00
%td.new_line{id: new_line_code, class: "#{new_line_class}", data: { linenumber: right[:number] }}
= link_to raw(right[:number]), "##{new_line_code}", id: new_line_code
- if @comments_allowed && can?(current_user, :create_note, @project)
= link_to_new_diff_note(right[:line_code], 'new')
%td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", data: { line_code: new_line_code }}= diff_line_content(right[:text])
2014-09-12 12:43:44 -04:00
- if @reply_allowed
- comments_left, comments_right = organize_comments(left[:type], right[:type], left[:line_code], right[:line_code])
2014-09-12 13:51:44 -04:00
- if comments_left.present? || comments_right.present?
= render "projects/notes/diff_notes_with_reply_parallel", notes_left: comments_left, notes_right: comments_right
2014-09-04 06:05:58 -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