Skip to content

Commit 562785e

Browse files
Gusted6543techknowlogick
authored
Add download button for file viewer (#17640)
- Resolves #17286 - Use the `download` attribute such that the browser will natively initate a download dialog for the given URL. Co-authored-by: 6543 <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent 10db864 commit 562785e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

options/locale/locale_en-US.ini

+1
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ commit_graph.hide_pr_refs = Hide Pull Requests
989989
commit_graph.monochrome = Mono
990990
commit_graph.color = Color
991991
blame = Blame
992+
download_file = Download file
992993
normal_view = Normal View
993994
line = line
994995
lines = lines

templates/repo/view_file.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
{{end}}
4949
<a class="ui mini basic button" href="{{.RepoLink}}/commits/{{EscapePound .BranchNameSubURL}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_history"}}</a>
5050
</div>
51+
<a download href="{{EscapePound $.RawFileLink}}"><span class="btn-octicon poping up" data-content="{{.i18n.Tr "repo.download_file"}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-download"}}</span></a>
5152
{{if .Repository.CanEnableEditor}}
5253
{{if .CanEditFile}}
5354
<a href="{{.RepoLink}}/_edit/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}"><span class="btn-octicon poping up" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-pencil"}}</span></a>

0 commit comments

Comments
 (0)