2016-08-17 09:16:29 -04:00
|
|
|
- email = local_assigns.fetch(:email, false)
|
2016-06-20 13:23:46 -04:00
|
|
|
- plain = local_assigns.fetch(:plain, false)
|
2017-03-08 11:07:26 -05:00
|
|
|
- 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)
|
2017-05-30 16:38:06 -04:00
|
|
|
- if discussions && line.discussable?
|
2017-03-30 22:34:14 -04:00
|
|
|
- line_discussions = discussions[line_code]
|
2017-03-08 11:07:26 -05:00
|
|
|
%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
|
2017-03-13 16:09:43 -04:00
|
|
|
- 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
|
2017-03-09 03:59:29 -05:00
|
|
|
%td.old_line.diff-line-num{ class: [type, ("js-avatar-container" if !plain)], data: { linenumber: line.old_pos } }
|
2016-06-18 11:19:57 -04:00
|
|
|
- link_text = type == "new" ? " " : line.old_pos
|
2016-06-20 13:23:46 -04:00
|
|
|
- if plain
|
2016-01-28 12:10:36 -05:00
|
|
|
= link_text
|
|
|
|
- else
|
2017-06-12 14:43:21 -04:00
|
|
|
= add_diff_note_button(line_code, diff_file.position(line), type)
|
2016-12-26 05:47:16 -05:00
|
|
|
%a{ href: "##{line_code}", data: { linenumber: link_text } }
|
2017-03-30 22:34:14 -04:00
|
|
|
- discussion = line_discussions.try(:first)
|
2017-03-09 03:59:29 -05:00
|
|
|
- if discussion && discussion.resolvable? && !plain
|
2017-03-08 11:07:26 -05:00
|
|
|
%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 } }
|
2016-06-18 11:19:57 -04:00
|
|
|
- link_text = type == "old" ? " " : line.new_pos
|
2016-06-20 13:23:46 -04:00
|
|
|
- if plain
|
2016-01-28 12:10:36 -05:00
|
|
|
= link_text
|
|
|
|
- else
|
2016-12-26 05:47:16 -05:00
|
|
|
%a{ href: "##{line_code}", data: { linenumber: link_text } }
|
2019-03-23 09:34:08 -04:00
|
|
|
%td.line_content{ class: type }<
|
2016-08-17 09:16:29 -04:00
|
|
|
- if email
|
2018-08-11 16:33:15 -04:00
|
|
|
%pre= line.rich_text
|
2016-08-17 09:16:29 -04:00
|
|
|
- else
|
2018-08-11 16:33:15 -04:00
|
|
|
= diff_line_content(line.rich_text)
|
2016-08-18 19:27:22 -04:00
|
|
|
|
2017-04-30 16:32:09 -04:00
|
|
|
- if line_discussions&.any?
|
2017-03-30 22:34:14 -04:00
|
|
|
- discussion_expanded = local_assigns.fetch(:discussion_expanded, line_discussions.any?(&:expanded?))
|
|
|
|
= render "discussions/diff_discussion", discussions: line_discussions, expanded: discussion_expanded
|