2016-01-28 12:10:36 -05:00
|
|
|
- type = line.type
|
2016-06-18 11:19:57 -04:00
|
|
|
- holder_data = @comments_target.any? ? { data: { noteable_id: @comments_target[:noteable_id], noteable_type: @comments_target[:noteable_type], commit_id: @comments_target[:commit_id], discussion_id: discussion_id(line_code), note_type: LegacyDiffNote.name } } : {}
|
|
|
|
%tr.line_holder{ holder_data, id: line_code, class: type }
|
2016-01-28 12:10:36 -05:00
|
|
|
- case type
|
|
|
|
- when 'match'
|
2016-04-14 10:10:36 -04:00
|
|
|
= render "projects/diffs/match_line", { line: line.text,
|
|
|
|
line_old: line.old_pos, line_new: line.new_pos, bottom: false, new_file: diff_file.new_file }
|
2016-01-28 12:10:36 -05:00
|
|
|
- when 'nonewline'
|
|
|
|
%td.old_line.diff-line-num
|
|
|
|
%td.new_line.diff-line-num
|
|
|
|
%td.line_content.match= line.text
|
|
|
|
- else
|
2016-04-14 10:10:36 -04:00
|
|
|
%td.old_line.diff-line-num{ class: type, data: { linenumber: line.new_pos } }
|
2016-06-18 11:19:57 -04:00
|
|
|
- link_text = type == "new" ? " " : line.old_pos
|
2016-01-28 12:10:36 -05:00
|
|
|
- if defined?(plain) && plain
|
|
|
|
= link_text
|
|
|
|
- else
|
2016-06-18 11:19:57 -04:00
|
|
|
%a{href: "##{line_code}", data: { linenumber: link_text }}= " "
|
2016-04-14 10:10:36 -04:00
|
|
|
%td.new_line.diff-line-num{ class: type, data: { linenumber: line.new_pos } }
|
2016-06-18 11:19:57 -04:00
|
|
|
- link_text = type == "old" ? " " : line.new_pos
|
2016-01-28 12:10:36 -05:00
|
|
|
- if defined?(plain) && plain
|
|
|
|
= link_text
|
|
|
|
- else
|
2016-06-18 11:19:57 -04:00
|
|
|
%a{href: "##{line_code}", data: { linenumber: link_text }}= ""
|
|
|
|
%td.line_content{ class: ['noteable_line', type], data: { line_code: line_code, line_type: type } }= diff_line_content(line.text, type)
|