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

37 lines
1.9 KiB
Text
Raw Normal View History

- environment = local_assigns.fetch(:environment, nil)
- diff_page_context = local_assigns.fetch(:diff_page_context, nil)
2017-05-15 13:18:19 -04:00
- file_hash = hexdigest(diff_file.file_path)
- image_diff = diff_file.rich_viewer && diff_file.rich_viewer.partial_name == 'image'
- image_replaced = diff_file.old_content_sha && diff_file.old_content_sha != diff_file.content_sha
.diff-file.file-holder{ id: file_hash, data: diff_file_html_data(project, diff_file.file_path, diff_file.content_sha) }
.js-file-title.file-title-flex-parent{ class: diff_page_context }
.file-header-content
= render "projects/diffs/file_header", diff_file: diff_file, url: "##{file_hash}"
- if diff_file.submodule?
.file-actions.d-none.d-sm-block
= submodule_diff_compare_link(diff_file)
- unless diff_file.submodule?
.file-actions.gl-display-none.gl-sm-display-flex
- if diff_file.blob&.readable_text?
%span.has-tooltip.gl-mr-3{ title: _("Toggle comments for this file") }
= link_to '#', class: 'js-toggle-diff-comments btn gl-button btn-default btn-icon selected', disabled: @diff_notes_disabled do
= sprite_icon('comment')
2016-01-21 16:46:49 -05:00
\
- if editable_diff?(diff_file)
- link_opts = @merge_request.persisted? ? { from_merge_request_iid: @merge_request.iid } : {}
2018-02-22 07:54:19 -05:00
= edit_blob_button(@merge_request.source_project, @merge_request.source_branch, diff_file.new_path,
blob: diff_file.blob, link_opts: link_opts)
- if image_diff && image_replaced
= view_file_button(diff_file.old_content_sha, diff_file.old_path, project, replaced: true)
= view_file_button(diff_file.content_sha, diff_file.file_path, project)
= view_on_environment_button(diff_file.content_sha, diff_file.file_path, environment) if environment
= render_fork_suggestion
= render 'projects/diffs/content', diff_file: diff_file