summaryrefslogtreecommitdiffstats
path: root/templates/repo/view_file.tmpl
diff options
context:
space:
mode:
authorJakub Stasiak <jakub@stasiak.at>2015-05-14 00:14:24 +0200
committerJakub Stasiak <jakub@stasiak.at>2015-07-13 21:52:48 +0200
commit562ad02a6da7323b3ec5e2b0259ee1f17935d5f6 (patch)
tree595ed1ee8902acbefa65098f9aec66c3827931dc /templates/repo/view_file.tmpl
parentced212f8fa6e4761bca0c635240e8147ae427435 (diff)
downloadgitea-562ad02a6da7323b3ec5e2b0259ee1f17935d5f6.tar.gz
gitea-562ad02a6da7323b3ec5e2b0259ee1f17935d5f6.zip
Add file permalink button
The button appears when a file is viewed in a branch or a tag. It points to a URL containing the branch's (or tag's) current commit id so that it'll always point to the same content.
Diffstat (limited to 'templates/repo/view_file.tmpl')
-rw-r--r--templates/repo/view_file.tmpl5
1 files changed, 5 insertions, 0 deletions
diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl
index d33cc95023..4d11170bd0 100644
--- a/templates/repo/view_file.tmpl
+++ b/templates/repo/view_file.tmpl
@@ -12,6 +12,11 @@
<strong class="file-name">{{.FileName}}</strong><span class="file-size">{{FileSize .FileSize}}</span>
{{end}}
{{if not .ReadmeInList}}
+ {{if not .IsCommit}}
+ <a class="right" href="{{.RepoLink}}/src/{{.CommitId}}/{{.TreeName}}">
+ <button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_permalink"}}</button>
+ </a>
+ {{end}}
<a class="right" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{.TreeName}}">
<button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_history"}}</button>
</a>