aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo/commits.tmpl
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-12-02 09:41:32 +0800
committerGitHub <noreply@github.com>2024-12-02 01:41:32 +0000
commite3e32605a144076572ac55fb5053655ee045a0f9 (patch)
tree2385ecadb2caf21b147a97d6f3237e5253b223ba /templates/repo/commits.tmpl
parentdef13ece7c7994e014e34cdc2fc4887d1998f019 (diff)
downloadgitea-e3e32605a144076572ac55fb5053655ee045a0f9.tar.gz
gitea-e3e32605a144076572ac55fb5053655ee045a0f9.zip
Refactor RepoBranchTagSelector (#32681)
Diffstat (limited to 'templates/repo/commits.tmpl')
-rw-r--r--templates/repo/commits.tmpl19
1 files changed, 18 insertions, 1 deletions
diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl
index 6bce585774..e79f3d7751 100644
--- a/templates/repo/commits.tmpl
+++ b/templates/repo/commits.tmpl
@@ -5,7 +5,24 @@
{{template "repo/sub_menu" .}}
<div class="repo-button-row">
<div class="repo-button-row-left">
- {{template "repo/branch_dropdown" dict "root" .}}
+
+ {{$branchDropdownCurrentRefType := "branch"}}
+ {{$branchDropdownCurrentRefShortName := .BranchName}}
+ {{if .IsViewTag}}
+ {{$branchDropdownCurrentRefType := "tag"}}
+ {{$branchDropdownCurrentRefShortName := .TagName}}
+ {{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"}}