Commit 50c12894 authored by Kia Mei Somabes's avatar Kia Mei Somabes

Add single file download in repository

parent 0ed8f349
...@@ -226,16 +226,16 @@ module BlobHelper ...@@ -226,16 +226,16 @@ module BlobHelper
def open_raw_blob_button(blob) def open_raw_blob_button(blob)
return if blob.empty? return if blob.empty?
if blob.raw_binary? || blob.stored_externally?
icon = sprite_icon('download')
title = 'Download'
else
icon = icon('file-code-o') icon = icon('file-code-o')
title = 'Open raw' title = 'Open raw'
link_to icon, blob_raw_path, class: 'btn btn-sm has-tooltip', target: '_blank', rel: 'noopener noreferrer', title: title, data: { container: 'body' }
end end
link_to icon, blob_raw_path, class: 'btn btn-sm has-tooltip', target: '_blank', rel: 'noopener noreferrer', title: title, data: { container: 'body' } def download_button(blob)
return if blob.empty?
icon = sprite_icon('download')
title = 'Download'
link_to icon, blob_raw_path, download: '', class: 'btn btn-sm has-tooltip', target: '_blank', rel: 'noopener noreferrer', title: title, data: { container: 'body' }
end end
def blob_render_error_reason(viewer) def blob_render_error_reason(viewer)
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
.btn-group{ role: "group" }< .btn-group{ role: "group" }<
= copy_blob_source_button(blob) unless blame = copy_blob_source_button(blob) unless blame
- if !(blob.raw_binary? || blob.stored_externally?)
= open_raw_blob_button(blob) = open_raw_blob_button(blob)
= download_button(blob)
= view_on_environment_button(@commit.sha, @path, @environment) if @environment = view_on_environment_button(@commit.sha, @path, @environment) if @environment
.btn-group{ role: "group" }< .btn-group{ role: "group" }<
= render_if_exists 'projects/blob/header_file_locks_link' = render_if_exists 'projects/blob/header_file_locks_link'
= edit_blob_button = edit_blob_button
......
---
title: Add download button for single file (including raw files) in repository
merge_request:
author:
type: added
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment