gitlab-org--gitlab-foss/app/views/projects/diffs/_line.html.haml

42 lines
1.7 KiB
Text
Raw Normal View History

- email = local_assigns.fetch(:email, false)
- plain = local_assigns.fetch(:plain, false)
- discussions = local_assigns.fetch(:discussions, nil)
2016-01-28 12:10:36 -05:00
- type = line.type
2016-08-18 19:27:22 -04:00
- line_code = diff_file.line_code(line)
- if discussions && line.discussable?
- line_discussions = discussions[line_code]
%tr.line_holder{ class: type, id: (line_code unless plain) }
2016-01-28 12:10:36 -05:00
- case type
- when 'match'
2016-07-21 14:44:12 -04:00
= diff_match_line line.old_pos, line.new_pos, text: line.text
- when 'old-nonewline', 'new-nonewline'
2016-01-28 12:10:36 -05:00
%td.old_line.diff-line-num
%td.new_line.diff-line-num
%td.line_content.match= line.text
- else
%td.old_line.diff-line-num{ class: [type, ("js-avatar-container" if !plain)], data: { linenumber: line.old_pos } }
- link_text = type == "new" ? " " : line.old_pos
- if plain
2016-01-28 12:10:36 -05:00
= link_text
- else
= add_diff_note_button(line_code, diff_file.position(line), type)
%a{ href: "##{line_code}", data: { linenumber: link_text } }
- discussion = line_discussions.try(:first)
- if discussion && discussion.resolvable? && !plain
%diff-note-avatars{ "discussion-id" => discussion.id }
2016-04-14 10:10:36 -04:00
%td.new_line.diff-line-num{ class: type, data: { linenumber: line.new_pos } }
- link_text = type == "old" ? " " : line.new_pos
- if plain
2016-01-28 12:10:36 -05:00
= link_text
- else
%a{ href: "##{line_code}", data: { linenumber: link_text } }
%td.line_content{ class: type }<
- if email
2018-08-11 16:33:15 -04:00
%pre= line.rich_text
- else
2018-08-11 16:33:15 -04:00
= diff_line_content(line.rich_text)
2016-08-18 19:27:22 -04:00
- if line_discussions&.any?
- discussion_expanded = local_assigns.fetch(:discussion_expanded, line_discussions.any?(&:expanded?))
= render "discussions/diff_discussion", discussions: line_discussions, expanded: discussion_expanded