Fix link to Code
tab on wiki commits (#28041)
Fixes https://codeberg.org/forgejo/forgejo/issues/1759 If you are bowing another branch than the default branch and click n the Code tab, it will take you to the root of the branch. The `BranchName` variable is also set when viewing a Wiki commit, so we also need to check if we are on a Wiki.
This commit is contained in:
parent
0a0e8200ec
commit
709a376c51
1 changed files with 1 additions and 1 deletions
|
@ -142,7 +142,7 @@
|
||||||
{{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
|
{{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
|
||||||
<div class="ui tabular menu navbar gt-overflow-x-auto gt-overflow-y-hidden">
|
<div class="ui tabular menu navbar gt-overflow-x-auto gt-overflow-y-hidden">
|
||||||
{{if .Permission.CanRead $.UnitTypeCode}}
|
{{if .Permission.CanRead $.UnitTypeCode}}
|
||||||
<a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL}}{{end}}">
|
<a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if and (ne .BranchName .Repository.DefaultBranch) (not $.PageIsWiki)}}/src/{{.BranchNameSubURL}}{{end}}">
|
||||||
{{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}}
|
{{svg "octicon-code"}} {{ctx.Locale.Tr "repo.code"}}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in a new issue