BigW Consortium Gitlab

_line.html.haml 1.74 KB
Newer Older
1
- email = local_assigns.fetch(:email, false)
2
- plain = local_assigns.fetch(:plain, false)
3
- discussions = local_assigns.fetch(:discussions, nil)
4
- type = line.type
5
- line_code = diff_file.line_code(line)
6
- if discussions && line.discussable?
7
  - line_discussions = discussions[line_code]
8
%tr.line_holder{ class: type, id: (line_code unless plain) }
9 10
  - case type
  - when 'match'
11
    = diff_match_line line.old_pos, line.new_pos, text: line.text
12
  - when 'old-nonewline', 'new-nonewline'
13 14 15 16
    %td.old_line.diff-line-num
    %td.new_line.diff-line-num
    %td.line_content.match= line.text
  - else
17
    %td.old_line.diff-line-num{ class: [type, ("js-avatar-container" if !plain)], data: { linenumber: line.old_pos } }
18
      - link_text = type == "new" ? " " : line.old_pos
19
      - if plain
20 21
        = link_text
      - else
22
        %a{ href: "##{line_code}", data: { linenumber: link_text } }
23
      - discussion = line_discussions.try(:first)
24
      - if discussion && discussion.resolvable? && !plain
25
        %diff-note-avatars{ "discussion-id" => discussion.id }
26
    %td.new_line.diff-line-num{ class: type, data: { linenumber: line.new_pos } }
27
      - link_text = type == "old" ? " " : line.new_pos
28
      - if plain
29 30
        = link_text
      - else
31
        %a{ href: "##{line_code}", data: { linenumber: link_text } }
32 33
    %td.line_content.noteable_line{ class: type, data: (diff_view_line_data(line_code, diff_file.position(line), type) unless plain) }<
      - if email
34
        %pre= line.text
35
      - else
36
        = diff_line_content(line.text)
37

38
- if line_discussions&.any?
39 40
  - discussion_expanded = local_assigns.fetch(:discussion_expanded, line_discussions.any?(&:expanded?))
  = render "discussions/diff_discussion", discussions: line_discussions, expanded: discussion_expanded