debian-mirror-gitlab/app/views/projects/diffs/_line.html.haml

41 lines
1.7 KiB
Text
Raw Normal View History

2016-09-13 17:45:13 +05:30
- email = local_assigns.fetch(:email, false)
2016-08-24 12:49:21 +05:30
- plain = local_assigns.fetch(:plain, false)
2017-08-17 22:00:37 +05:30
- discussions = local_assigns.fetch(:discussions, nil)
2016-06-02 11:05:42 +05:30
- type = line.type
2016-09-13 17:45:13 +05:30
- line_code = diff_file.line_code(line)
2017-08-17 22:00:37 +05:30
- if discussions && !line.meta?
- line_discussions = discussions[line_code]
%tr.line_holder{ class: type, id: (line_code unless plain) }
2016-06-02 11:05:42 +05:30
- case type
- when 'match'
2016-09-13 17:45:13 +05:30
= diff_match_line line.old_pos, line.new_pos, text: line.text
2017-08-17 22:00:37 +05:30
- when 'old-nonewline', 'new-nonewline'
2016-06-02 11:05:42 +05:30
%td.old_line.diff-line-num
%td.new_line.diff-line-num
%td.line_content.match= line.text
- else
2017-08-17 22:00:37 +05:30
%td.old_line.diff-line-num{ class: [type, ("js-avatar-container" if !plain)], data: { linenumber: line.old_pos } }
2016-08-24 12:49:21 +05:30
- link_text = type == "new" ? " " : line.old_pos
- if plain
2016-06-02 11:05:42 +05:30
= link_text
- else
2017-08-17 22:00:37 +05:30
%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-06-02 11:05:42 +05:30
%td.new_line.diff-line-num{ class: type, data: { linenumber: line.new_pos } }
2016-08-24 12:49:21 +05:30
- link_text = type == "old" ? " " : line.new_pos
- if plain
2016-06-02 11:05:42 +05:30
= link_text
- else
2017-08-17 22:00:37 +05:30
%a{ href: "##{line_code}", data: { linenumber: link_text } }
2016-09-13 17:45:13 +05:30
%td.line_content.noteable_line{ class: type, data: (diff_view_line_data(line_code, diff_file.position(line), type) unless plain) }<
- if email
2017-08-17 22:00:37 +05:30
%pre= line.text
2016-09-13 17:45:13 +05:30
- else
2017-08-17 22:00:37 +05:30
= diff_line_content(line.text)
2016-09-13 17:45:13 +05:30
2017-08-17 22:00:37 +05:30
- 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