Skip to content
Snippets Groups Projects
Commit 50c12894 authored by Kia Mei Somabes's avatar Kia Mei Somabes
Browse files

Add single file download in repository

parent 0ed8f349
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
---
title: Add download button for single file (including raw files) in repository
merge_request:
author:
type: added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment