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

Add single file download in repository

parent 0ed8f349
......@@ -226,18 +226,18 @@ module BlobHelper
def open_raw_blob_button(blob)
return if blob.empty?
if blob.raw_binary? || blob.stored_externally?
icon = sprite_icon('download')
title = 'Download'
else
icon = icon('file-code-o')
title = 'Open raw'
end
icon = icon('file-code-o')
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
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
def blob_render_error_reason(viewer)
case viewer.render_error
when :collapsed
......
......@@ -7,9 +7,10 @@
.btn-group{ role: "group" }<
= copy_blob_source_button(blob) unless blame
= open_raw_blob_button(blob)
- if !(blob.raw_binary? || blob.stored_externally?)
= open_raw_blob_button(blob)
= download_button(blob)
= view_on_environment_button(@commit.sha, @path, @environment) if @environment
.btn-group{ role: "group" }<
= render_if_exists 'projects/blob/header_file_locks_link'
= 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