BigW Consortium Gitlab

_parallel_view.html.haml 2.12 KB
Newer Older
1
/ Side-by-side diff view
2
%div.text-file.diff-wrap-lines.code.file-content.js-syntax-highlight{ data: diff_view_data }
3
  %table
4
    - last_line = 0
5
    - diff_file.parallel_diff_lines.each do |line|
6 7
      - left = line[:left]
      - right = line[:right]
8
      - last_line = right.new_pos if right
9
      %tr.line_holder.parallel
10 11
        - if left
          - if left.meta?
12
            = diff_match_line left.old_pos, nil, text: left.text, view: :parallel
13 14 15 16 17 18
          - else
            - left_line_code = diff_file.line_code(left)
            - left_position = diff_file.position(left)
            %td.old_line.diff-line-num{id: left_line_code, class: left.type, data: { linenumber: left.old_pos }}
              %a{href: "##{left_line_code}" }= raw(left.old_pos)
            %td.line_content.parallel.noteable_line{class: left.type, data: diff_view_line_data(left_line_code, left_position, 'old')}= diff_line_content(left.text)
19
        - else
20 21
          %td.old_line.diff-line-num.empty-cell
          %td.line_content.parallel
22

23 24
        - if right
          - if right.meta?
25
            = diff_match_line nil, right.new_pos, text: left.text, view: :parallel
26
          - else
27 28 29 30 31 32 33 34
            - right_line_code = diff_file.line_code(right)
            - right_position = diff_file.position(right)
            %td.new_line.diff-line-num{id: right_line_code, class: right.type, data: { linenumber: right.new_pos }}
              %a{href: "##{right_line_code}" }= raw(right.new_pos)
            %td.line_content.parallel.noteable_line{class: right.type, data: diff_view_line_data(right_line_code, right_position, 'new')}= diff_line_content(right.text)
        - else
          %td.old_line.diff-line-num.empty-cell
          %td.line_content.parallel
35

36
      - unless @diff_notes_disabled
37 38 39
        - discussion_left, discussion_right = parallel_diff_discussions(left, right, diff_file)
        - if discussion_left || discussion_right
          = render "discussions/parallel_diff_discussion", discussion_left: discussion_left, discussion_right: discussion_right
40 41
    - if !diff_file.new_file && last_line > 0
      = diff_match_line last_line, last_line, bottom: true, view: :parallel