Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
50c12894
Commit
50c12894
authored
Jul 09, 2018
by
Kia Mei Somabes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add single file download in repository
parent
0ed8f349
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+9
-9
app/views/projects/blob/_header.html.haml
app/views/projects/blob/_header.html.haml
+3
-2
changelogs/unreleased/23705-add-single-file-download-in-repo.yml
...ogs/unreleased/23705-add-single-file-download-in-repo.yml
+5
-0
No files found.
app/helpers/blob_helper.rb
View file @
50c12894
...
@@ -226,18 +226,18 @@ module BlobHelper
...
@@ -226,18 +226,18 @@ module BlobHelper
def
open_raw_blob_button
(
blob
)
def
open_raw_blob_button
(
blob
)
return
if
blob
.
empty?
return
if
blob
.
empty?
icon
=
icon
(
'file-code-o'
)
if
blob
.
raw_binary?
||
blob
.
stored_externally?
title
=
'Open raw'
icon
=
sprite_icon
(
'download'
)
title
=
'Download'
else
icon
=
icon
(
'file-code-o'
)
title
=
'Open raw'
end
link_to
icon
,
blob_raw_path
,
class:
'btn btn-sm has-tooltip'
,
target:
'_blank'
,
rel:
'noopener noreferrer'
,
title:
title
,
data:
{
container:
'body'
}
link_to
icon
,
blob_raw_path
,
class:
'btn btn-sm has-tooltip'
,
target:
'_blank'
,
rel:
'noopener noreferrer'
,
title:
title
,
data:
{
container:
'body'
}
end
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
)
def
blob_render_error_reason
(
viewer
)
case
viewer
.
render_error
case
viewer
.
render_error
when
:collapsed
when
:collapsed
...
...
app/views/projects/blob/_header.html.haml
View file @
50c12894
...
@@ -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
=
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
=
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
...
...
changelogs/unreleased/23705-add-single-file-download-in-repo.yml
0 → 100644
View file @
50c12894
---
title
:
Add download button for single file (including raw files) in repository
merge_request
:
author
:
type
:
added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment