]> source.dussan.org Git - gitea.git/commitdiff
Add download button for file viewer (#17640)
authorGusted <williamzijl7@hotmail.com>
Mon, 15 Nov 2021 01:05:12 +0000 (01:05 +0000)
committerGitHub <noreply@github.com>
Mon, 15 Nov 2021 01:05:12 +0000 (09:05 +0800)
- 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>
options/locale/locale_en-US.ini
templates/repo/view_file.tmpl

index 7d6c878ad6c287f6291cc723b1dc03cd8ac570f6..2069b20530149fef945e63690b8561443bd47804 100644 (file)
@@ -989,6 +989,7 @@ commit_graph.hide_pr_refs = Hide Pull Requests
 commit_graph.monochrome = Mono
 commit_graph.color = Color
 blame = Blame
+download_file = Download file
 normal_view = Normal View
 line = line
 lines = lines
index 0c8990a4f5c8d8121e8d0ac7aec783625761c59e..2c678beb9073657b73a1fa53e223fcc0d69f8a2b 100644 (file)
@@ -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>