diff options
author | Gusted <williamzijl7@hotmail.com> | 2021-11-15 01:05:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-15 09:05:12 +0800 |
commit | 562785ef4ea8ea4b24da726a4fbf515358ee7084 (patch) | |
tree | e5a2c5454c31e9af91ea1605ebea188c8c1d661f /templates | |
parent | 10db864c66a5c7f8829887a28299864a7da22122 (diff) | |
download | gitea-562785ef4ea8ea4b24da726a4fbf515358ee7084.tar.gz gitea-562785ef4ea8ea4b24da726a4fbf515358ee7084.zip |
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 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/view_file.tmpl | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index 0c8990a4f5..2c678beb90 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -48,6 +48,7 @@ {{end}} <a class="ui mini basic button" href="{{.RepoLink}}/commits/{{EscapePound .BranchNameSubURL}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_history"}}</a> </div> + <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> {{if .Repository.CanEnableEditor}} {{if .CanEditFile}} <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> |