_parallel_view.html.haml 2.3 KB
Newer Older
1
/ Side-by-side diff view
2
%div.text-file.diff-wrap-lines.code.file-content.js-syntax-highlight{ class: user_color_scheme }
3
  %table
D
Dmitriy Zaporozhets 已提交
4
    - parallel_diff(diff_file, index).each do |line|
5 6 7
      - type_left = line[0]
      - line_number_left = line[1]
      - line_content_left = line[2]
8
      - line_code_left = line[3]
9 10 11 12
      - type_right = line[4]
      - line_number_right = line[5]
      - line_content_right = line[6]
      - line_code_right = line[7]
13

14
      %tr.line_holder.parallel
15
        - if type_left == 'match'
D
Dmitriy Zaporozhets 已提交
16
          = render "projects/diffs/match_line_parallel", { line: line_content_left,
M
Cleanup  
Marin Jankovski 已提交
17 18
          line_old: line_number_left, line_new: line_number_right }
        - elsif type_left ==  'old' || type_left.nil?
19 20
          %td.old_line{id: line_code_left, class: "#{type_left}"}
            = link_to raw(line_number_left), "##{line_code_left}", id: line_code_left
21
            - if @comments_allowed && can?(current_user, :create_note, @project)
22
              = link_to_new_diff_note(line_code_left, 'old')
23
            %td.line_content{class: "parallel noteable_line #{type_left} #{line_code_left}", "line_code" => line_code_left }= line_content_left.html_safe
24 25 26

          - if type_right == 'new'
            - new_line_class = 'new'
27
            - new_line_code = line_code_right
28 29
          - else
            - new_line_class = nil
30
            - new_line_code = line_code_left
31 32 33

          %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
34
            - if @comments_allowed && can?(current_user, :create_note, @project)
35
              = link_to_new_diff_note(line_code_right, 'new')
36
            %td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", "line_code" => new_line_code}= line_content_right.html_safe
37 38

      - if @reply_allowed
39 40
        - comments_left, comments_right = organize_comments(type_left, type_right, line_code_left, line_code_right)
        - if comments_left.present? || comments_right.present?
41
          = render "projects/notes/diff_notes_with_reply_parallel", notes_left: comments_left, notes_right: comments_right
M
Marin Jankovski 已提交
42

D
Dmitriy Zaporozhets 已提交
43
- if diff_file.diff.diff.blank? && diff_file.mode_changed?
M
Marin Jankovski 已提交
44 45
  .file-mode-changed
    File mode changed