1
1
mirror of https://github.com/go-gitea/gitea synced 2025-01-19 06:04:26 +00:00
gitea/templates/repo/commits.tmpl
Giteabot 15ad001aef
Fix branch dropdown not display ref name (#33159) (#33183)
Backport #33159 by @yp05327

Before:

![image](https://github.com/user-attachments/assets/899d25a9-80e9-48d5-a820-79c911c858e9)
After:

![image](https://github.com/user-attachments/assets/cf2a7407-909a-41db-9957-19d9214af57e)

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-01-10 01:41:52 +00:00

40 lines
1.5 KiB
Handlebars

{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository commits">
{{template "repo/header" .}}
<div class="ui container">
{{template "repo/sub_menu" .}}
<div class="repo-button-row">
<div class="repo-button-row-left">
{{- /* for /owner/repo/commits/branch/the-name */ -}}
{{- $branchDropdownCurrentRefType := "branch" -}}
{{- $branchDropdownCurrentRefShortName := .BranchName -}}
{{- if .IsViewTag -}}
{{- /* for /owner/repo/commits/tag/the-name */ -}}
{{- $branchDropdownCurrentRefType = "tag" -}}
{{- $branchDropdownCurrentRefShortName = .TagName -}}
{{- else if .IsViewCommit -}}
{{- /* for /owner/repo/commits/commit/000000 */ -}}
{{- $branchDropdownCurrentRefType = "commit" -}}
{{- $branchDropdownCurrentRefShortName = ShortSha .CommitID -}}
{{- end -}}
{{- template "repo/branch_dropdown" dict
"Repository" .Repository
"ShowTabBranches" true
"ShowTabTags" true
"CurrentRefType" $branchDropdownCurrentRefType
"CurrentRefShortName" $branchDropdownCurrentRefShortName
"CurrentTreePath" .TreePath
"RefLinkTemplate" "{RepoLink}/commits/{RefType}/{RefShortName}/{TreePath}"
"AllowCreateNewRef" .CanCreateBranch
-}}
<a href="{{.RepoLink}}/graph" class="ui basic small compact button">
{{svg "octicon-git-branch"}}
{{ctx.Locale.Tr "repo.commit_graph"}}
</a>
</div>
</div>
{{template "repo/commits_table" .}}
</div>
</div>
{{template "base/footer" .}}