diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-09-12 18:43:44 +0200 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-09-12 18:44:53 +0200 |
commit | 5564fe31491a8a584b66feb6097742ec4025b8fa (patch) | |
tree | 87cfd197e994c182b901453b7076250874447010 /app/views/projects/diffs/_parallel_view.html.haml | |
parent | 29f990002c6e2704bb25ba4aa89491f319699202 (diff) | |
download | gitlab-ce-5564fe31491a8a584b66feb6097742ec4025b8fa.tar.gz |
Add comments on the side-by-side diff.
Diffstat (limited to 'app/views/projects/diffs/_parallel_view.html.haml')
-rw-r--r-- | app/views/projects/diffs/_parallel_view.html.haml | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml index 3ec769e0b83..8abbba5b46d 100644 --- a/app/views/projects/diffs/_parallel_view.html.haml +++ b/app/views/projects/diffs/_parallel_view.html.haml @@ -6,21 +6,41 @@ - line_number_left = line[1] - line_content_left = line[2] - line_code = line[3] - - type_right = line[4] - - line_number_right = line[5] - - line_content_right = line[6] + - line_code_next = line[4] + - type_right = line[5] + - line_number_right = line[6] + - line_content_right = line[7] - %tr.line_holder.parallel{id: line_code} + %tr.line_holder.parallel - if type_left == 'match' = render "projects/diffs/match_line_parallel", { line: line_content_left, line_old: line_number_left, line_new: line_number_right } - elsif type_left == 'old' || type_left.nil? - %td.old_line{class: "#{type_left}"} + %td.old_line{id: line_code, class: "#{type_left}"} = link_to raw(line_number_left), "##{line_code}", id: line_code %td.line_content{class: "parallel noteable_line #{type_left} #{line_code}", "line_code" => line_code }= raw line_content_left - %td.new_line{ class: "#{type_right == 'new' ? 'new' : nil}", data: { linenumber: line_number_right }} - = link_to raw(line_number_right), "##{line_code}", id: line_code - %td.line_content.parallel{class: "noteable_line #{type_right == 'new' ? 'new' : nil} #{line_code}", "line_code" => line_code}= raw line_content_right + + - if type_right == 'new' + - new_line_class = 'new' + - new_line_code = line_code_next + - else + - new_line_class = nil + - new_line_code = line_code + + %td.new_line{id: new_line_code, class: "#{new_line_class}", data: { linenumber: line_number_right }} + = link_to raw(line_number_right), "##{new_line_code}", id: new_line_code + %td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", "line_code" => new_line_code}= raw line_content_right + + - if @reply_allowed + - if type_left.nil? && type_right == 'new' + - comments1 = nil + - else + - comments1 = line_comments[line_code] + - unless type_left.nil? && type_right.nil? + - comments2 = line_comments[line_code_next] + + - if comments1.present? || comments2.present? + = render "projects/notes/diff_notes_with_reply_parallel", notes1: comments1, notes2: comments2 - if diff_file.diff.diff.blank? && diff_file.mode_changed? .file-mode-changed |