2016-07-20 18:18:18 -04:00
|
|
|
- diff_file = discussion.diff_file
|
2017-10-07 00:25:17 -04:00
|
|
|
- diff_file_class = diff_file.text? ? 'text-file' : 'js-image-file'
|
2018-03-13 08:01:36 -04:00
|
|
|
- diff_data = {}
|
|
|
|
- expanded = discussion.expanded? || local_assigns.fetch(:expanded, nil)
|
|
|
|
- unless expanded
|
|
|
|
- diff_data = { lines_path: project_merge_request_discussion_path(discussion.project, discussion.noteable, discussion) }
|
2016-07-20 18:18:18 -04:00
|
|
|
|
2018-04-12 12:29:54 -04:00
|
|
|
.diff-file.file-holder.js-lazy-load-discussion{ class: diff_file_class, data: diff_data }
|
2017-06-14 14:14:59 -04:00
|
|
|
.js-file-title.file-title.file-title-flex-parent
|
|
|
|
.file-header-content
|
|
|
|
= render "projects/diffs/file_header", diff_file: diff_file, url: discussion_path(discussion), show_toggle: false
|
2016-07-20 18:18:18 -04:00
|
|
|
|
2017-10-07 00:25:17 -04:00
|
|
|
- if diff_file.text?
|
2019-03-23 09:22:16 -04:00
|
|
|
.diff-content
|
|
|
|
%table.code.js-syntax-highlight
|
2018-03-13 08:01:36 -04:00
|
|
|
- if expanded
|
|
|
|
- discussions = { discussion.original_line_code => [discussion] }
|
|
|
|
= render partial: "projects/diffs/line",
|
|
|
|
collection: discussion.truncated_diff_lines,
|
|
|
|
as: :line,
|
|
|
|
locals: { diff_file: diff_file,
|
|
|
|
discussions: discussions,
|
|
|
|
discussion_expanded: true,
|
|
|
|
plain: true }
|
|
|
|
- else
|
|
|
|
%tr.line_holder.line-holder-placeholder
|
|
|
|
%td.old_line.diff-line-num
|
|
|
|
%td.new_line.diff-line-num
|
2018-04-13 04:16:06 -04:00
|
|
|
%td.line_content.js-success-lazy-load
|
2018-03-13 08:01:36 -04:00
|
|
|
.js-code-placeholder
|
2018-04-16 13:48:53 -04:00
|
|
|
%td.js-error-lazy-load-diff.hidden.diff-loading-error-block
|
2022-02-03 10:12:41 -05:00
|
|
|
- button = button_tag(_("Try again"), class: "btn-link gl-button btn-link-retry gl-p-0 js-toggle-lazy-diff-retry-button")
|
2018-04-13 04:16:06 -04:00
|
|
|
= _("Unable to load the diff. %{button_try_again}").html_safe % { button_try_again: button}
|
2018-03-13 08:01:36 -04:00
|
|
|
= render "discussions/diff_discussion", discussions: [discussion], expanded: true
|
2017-10-07 00:25:17 -04:00
|
|
|
- else
|
|
|
|
- partial = (diff_file.new_file? || diff_file.deleted_file?) ? 'single_image_diff' : 'replaced_image_diff'
|
|
|
|
= render partial: "projects/diffs/#{partial}", locals: { diff_file: diff_file, position: discussion.position.to_json, click_to_comment: false }
|
|
|
|
.note-container
|
2017-10-10 11:36:32 -04:00
|
|
|
= render partial: "discussions/notes", locals: { discussion: discussion, show_toggle: false, show_image_comment_badge: true, disable_collapse_class: true }
|