diff options
author | Rémy Coutable <remy@rymai.me> | 2017-09-22 06:28:53 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-22 06:28:53 +0000 |
commit | d103e95513704314a38ab8ae441851524031c4a1 (patch) | |
tree | 0a3d6c7d7b824226351571232fac96ce3ef52ae3 /app/views | |
parent | f357fc7d2c1f3898b1ce0df7f97665aa8230d05e (diff) | |
parent | 9c096ddf28d63a89ff2844514bde9ab93a8756ae (diff) | |
download | gitlab-ce-d103e95513704314a38ab8ae441851524031c4a1.tar.gz |
Merge branch 'add-view-replaced-file-link' into 'master'
Add view replaced file link for image diffs
See merge request gitlab-org/gitlab-ce!14394
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/projects/diffs/_file.html.haml | 6 | ||||
-rw-r--r-- | app/views/projects/diffs/viewers/_image.html.haml | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml index b5aea217384..adc4dcbed33 100644 --- a/app/views/projects/diffs/_file.html.haml +++ b/app/views/projects/diffs/_file.html.haml @@ -1,5 +1,8 @@ - environment = local_assigns.fetch(:environment, nil) - 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 .file-header-content @@ -17,6 +20,9 @@ = edit_blob_link(@merge_request.source_project, @merge_request.source_branch, diff_file.new_path, blob: 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 diff --git a/app/views/projects/diffs/viewers/_image.html.haml b/app/views/projects/diffs/viewers/_image.html.haml index 01879556894..6b5233833c6 100644 --- a/app/views/projects/diffs/viewers/_image.html.haml +++ b/app/views/projects/diffs/viewers/_image.html.haml @@ -15,8 +15,7 @@ .two-up.view %span.wrap .frame.deleted - %a{ href: project_blob_path(@project, tree_join(diff_file.old_content_sha, diff_file.old_path)) } - = image_tag(old_blob_raw_path, alt: diff_file.old_path) + = image_tag(old_blob_raw_path, alt: diff_file.old_path) %p.image-info.hide %span.meta-filesize= number_to_human_size(old_blob.size) | @@ -27,8 +26,7 @@ %span.meta-height %span.wrap .frame.added - %a{ href: project_blob_path(@project, tree_join(diff_file.content_sha, diff_file.new_path)) } - = image_tag(blob_raw_path, alt: diff_file.new_path) + = image_tag(blob_raw_path, alt: diff_file.new_path) %p.image-info.hide %span.meta-filesize= number_to_human_size(blob.size) | |