File: _parallel_view.html.haml

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (56 lines) | stat: -rw-r--r-- 3,131 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/ Side-by-side diff view

.text-file{ data: diff_view_data }
  %table.diff-wrap-lines.code.code-commit.js-syntax-highlight
    - diff_file.parallel_diff_lines.each do |line|
      - left = line[:left]
      - right = line[:right]
      - discussions_left, discussions_right = parallel_diff_discussions(left, right, diff_file)
      %tr.line_holder.parallel
        - if left
          - case left.type
          - when 'match'
            = diff_match_line left.old_pos, nil, text: left.text, view: :parallel
          - when 'old-nomappinginraw', 'new-nomappinginraw', 'unchanged-nomappinginraw'
            = diff_nomappinginraw_line left, %w[old_line diff-line-num], nil, %w[line_content parallel left-side]
          - when 'old-nonewline', 'new-nonewline'
            %td.old_line.diff-line-num
            %td.line_content.match.left-side= left.text
          - else
            - left_line_code = diff_file.line_code(left)
            - left_position = diff_file.position(left)
            %td.old_line.diff-line-num.js-avatar-container{ class: left.type, data: { linenumber: left.old_pos } }
              = add_diff_note_button(left_line_code, left_position, 'old')
              %a{ href: "##{left_line_code}", data: { linenumber: left.old_pos } }
            %td.line_content.parallel.left-side{ id: left_line_code, class: left.type }= diff_line_content(left.rich_text)
        - else
          %td.old_line.diff-line-num.empty-cell
          %td.line_content.parallel.left-side

        - if right
          - case right.type
          - when 'match'
            = diff_match_line nil, right.new_pos, text: left.text, view: :parallel
          - when 'old-nomappinginraw', 'new-nomappinginraw', 'unchanged-nomappinginraw'
            = diff_nomappinginraw_line right, %w[new_line diff-line-num], nil, %w[line_content parallel right-side]
          - when 'old-nonewline', 'new-nonewline'
            %td.new_line.diff-line-num
            %td.line_content.match.right-side= right.text
          - else
            - right_line_code = diff_file.line_code(right)
            - right_position = diff_file.position(right)
            %td.new_line.diff-line-num.js-avatar-container{ class: right.type, data: { linenumber: right.new_pos } }
              = add_diff_note_button(right_line_code, right_position, 'new')
              %a{ href: "##{right_line_code}", data: { linenumber: right.new_pos } }
            %td.line_content.parallel.right-side{ id: right_line_code, class: right.type }= diff_line_content(right.rich_text)
        - else
          %td.old_line.diff-line-num.empty-cell
          %td.line_content.parallel.right-side

      - if discussions_left || discussions_right
        = render "discussions/parallel_diff_discussion", discussions_left: discussions_left, discussions_right: discussions_right
    - if !diff_file.new_file? && !diff_file.deleted_file? && diff_file.diff_lines.any?
      - last_line = diff_file.diff_lines.last
      - if last_line.new_pos < total_lines
        %tr.line_holder.parallel
          = diff_match_line last_line.old_pos, last_line.new_pos, bottom: true, view: :parallel