debian-mirror-gitlab/app/views/projects/diffs/_parallel_view.html.haml

44 lines
2.3 KiB
Text
Raw Normal View History

2015-04-26 12:48:37 +05:30
/ Side-by-side diff view
2016-01-29 22:53:50 +05:30
%div.text-file.diff-wrap-lines.code.file-content.js-syntax-highlight
2015-04-26 12:48:37 +05:30
%table
2016-01-29 22:53:50 +05:30
- diff_file.parallel_diff_lines.each do |line|
- left = line[:left]
- right = line[:right]
2015-04-26 12:48:37 +05:30
%tr.line_holder.parallel
2016-01-29 22:53:50 +05:30
- 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'
2016-02-05 20:25:01 +05:30
%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-29 22:53:50 +05:30
- else
2016-02-05 20:25:01 +05:30
%td.old_line.diff-line-num{id: left[:line_code], class: "#{left[:type]}"}
2016-01-29 22:53:50 +05:30
= link_to raw(left[:number]), "##{left[:line_code]}", id: left[:line_code]
2015-09-11 14:41:01 +05:30
- if @comments_allowed && can?(current_user, :create_note, @project)
2016-01-29 22:53:50 +05:30
= link_to_new_diff_note(left[:line_code], 'old')
2016-02-05 20:25:01 +05:30
%td.line_content{class: "parallel noteable_line #{left[:type]} #{left[:line_code]}", data: { line_code: left[:line_code] }}= diff_line_content(left[:text])
2015-04-26 12:48:37 +05:30
2016-01-29 22:53:50 +05:30
- if right[:type] == 'new'
2015-04-26 12:48:37 +05:30
- new_line_class = 'new'
2016-01-29 22:53:50 +05:30
- new_line_code = right[:line_code]
2015-04-26 12:48:37 +05:30
- else
- new_line_class = nil
2016-01-29 22:53:50 +05:30
- new_line_code = left[:line_code]
2015-04-26 12:48:37 +05:30
2016-02-05 20:25:01 +05:30
%td.new_line.diff-line-num{id: new_line_code, class: "#{new_line_class}", data: { linenumber: right[:number] }}
2016-01-29 22:53:50 +05:30
= link_to raw(right[:number]), "##{new_line_code}", id: new_line_code
2015-09-11 14:41:01 +05:30
- if @comments_allowed && can?(current_user, :create_note, @project)
2016-01-29 22:53:50 +05:30
= link_to_new_diff_note(right[:line_code], 'new')
2016-02-05 20:25:01 +05:30
%td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", data: { line_code: new_line_code }}= diff_line_content(right[:text])
2015-04-26 12:48:37 +05:30
- if @reply_allowed
2016-01-29 22:53:50 +05:30
- comments_left, comments_right = organize_comments(left[:type], right[:type], left[:line_code], right[:line_code])
2015-04-26 12:48:37 +05:30
- if comments_left.present? || comments_right.present?
2015-09-11 14:41:01 +05:30
= render "projects/notes/diff_notes_with_reply_parallel", notes_left: comments_left, notes_right: comments_right
2015-04-26 12:48:37 +05:30
- if diff_file.diff.diff.blank? && diff_file.mode_changed?
.file-mode-changed
File mode changed