_parallel_view.html.haml 2.37 KB
Newer Older
1
/ Side-by-side diff view
2 3
- text_file_data = @comments_target.any? ? { data: { noteable_id: @comments_target[:noteable_id], noteable_type: @comments_target[:noteable_type], commit_id: @comments_target[:commit_id], note_type: LegacyDiffNote.name } } : {}
%div.text-file.diff-wrap-lines.code.file-content.js-syntax-highlight{ text_file_data }
4
  %table
5
    - diff_file.parallel_diff_lines.each do |line|
6 7
      - left = line[:left]
      - right = line[:right]
8
      %tr.line_holder.parallel
9
        - if left[:type] == 'match'
10
          = render "projects/diffs/match_line_parallel", { line: left[:text] }
11
        - elsif left[:type] == 'nonewline'
12
          %td.old_line.diff-line-num.empty-cell
13
          %td.line_content.parallel.match= left[:text]
14
          %td.new_line.diff-line-num.empty-cell
15
          %td.line_content.parallel.match= left[:text]
16
        - else
17 18 19
          %td.old_line.diff-line-num{id: left[:line_code], class: "#{left[:type]} #{'empty-cell' if !left[:number]}", data: { linenumber: left[:number] }}
            %a{href: "##{left[:line_code]}" }= raw(left[:number])
          %td.line_content{class: "parallel noteable_line #{left[:type]} #{'empty-cell' if left[:text].empty?}", data: { discussion_id: discussion_id(left[:line_code]), line_type: left[:type], line_code: left[:line_code] }}= diff_line_content(left[:text])
20

21
          - if right[:type] == 'new'
22
            - new_line_class = 'new'
23
            - new_line_code = right[:line_code]
24 25
          - else
            - new_line_class = nil
26
            - new_line_code = left[:line_code]
27

28 29 30
          %td.new_line.diff-line-num{id: new_line_code, class: "#{new_line_class} #{'empty-cell' if !right[:number]}", data: { linenumber: right[:number] } }
            %a{href: "##{new_line_code}" }= raw(right[:number])
          %td.line_content.parallel{class: "noteable_line #{new_line_class} #{'empty-cell' if right[:text].empty?}", data: { discussion_id: discussion_id(new_line_code), line_type: new_line_class, line_code: new_line_code }}= diff_line_content(right[:text])
31

32
      - unless @diff_notes_disabled
33 34 35
        - 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
Marin Jankovski's avatar
Marin Jankovski committed
36

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
37
- if diff_file.diff.diff.blank? && diff_file.mode_changed?
Marin Jankovski's avatar
Marin Jankovski committed
38 39
  .file-mode-changed
    File mode changed