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

31 lines
1.2 KiB
Plaintext
Raw Normal View History

- email = local_assigns.fetch(:email, false)
- plain = local_assigns.fetch(:plain, false)
2016-01-28 17:10:36 +00:00
- type = line.type
- line_code = diff_file.line_code(line) unless plain
%tr.line_holder{ plain ? { class: type} : { class: type, id: line_code } }
2016-01-28 17:10:36 +00:00
- case type
- when 'match'
2016-07-21 18:44:12 +00:00
= diff_match_line line.old_pos, line.new_pos, text: line.text
2016-01-28 17:10:36 +00:00
- when 'nonewline'
%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, data: { linenumber: line.old_pos } }
- link_text = type == "new" ? " " : line.old_pos
- if plain
2016-01-28 17:10:36 +00:00
= link_text
- else
%a{href: "##{line_code}", data: { linenumber: link_text }}
2016-04-14 14:10:36 +00: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 17:10:36 +00:00
= link_text
- else
%a{href: "##{line_code}", data: { linenumber: link_text }}
%td.line_content.noteable_line{ class: type, data: (diff_view_line_data(line_code, diff_file.position(line), type) unless plain) }<
- if email
%pre= diff_line_content(line.text, type)
- else
= diff_line_content(line.text, type)