Skip to content

Commit 83d1173

Browse files
decketechknowlogick
authored andcommitted
Add missing History link to directory listings (#4829)
The feature to list commits from a subdirectory is already there but so far the history link to it was missing. There is a History button in the view_file.tmpl already so avoid showing two history buttons in that case. The GitHub webinterface has the same History button in the same place so this makes gitea a little bit more compatible. Signed-off-by: Bernhard Froehlich <[email protected]>
1 parent aad5ccc commit 83d1173

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

templates/repo/home.tmpl

+9-4
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
{{ $l := Subtract $n 1}}
6565
<div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span></div>
6666
<div class="right fitted item" id="file-buttons">
67-
{{if .Repository.CanEnableEditor}}
68-
<div class="ui tiny blue buttons">
67+
<div class="ui tiny blue buttons">
68+
{{if .Repository.CanEnableEditor}}
6969
{{if .CanAddFile}}
7070
<a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
7171
{{.i18n.Tr "repo.editor.new_file"}}
@@ -76,8 +76,13 @@
7676
{{.i18n.Tr "repo.editor.upload_file"}}
7777
</a>
7878
{{end}}
79-
</div>
80-
{{end}}
79+
{{end}}
80+
{{if and (ne $n 0) (not .IsViewFile)}}
81+
<a href="{{.RepoLink}}/commits/{{EscapePound .BranchNameSubURL}}/{{EscapePound .TreePath}}" class="ui button">
82+
{{.i18n.Tr "repo.file_history"}}
83+
</a>
84+
{{end}}
85+
</div>
8186

8287
</div>
8388
<div class="fitted item">

0 commit comments

Comments
 (0)