- {{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
+ }}
+
{{svg "octicon-git-branch"}}
{{ctx.Locale.Tr "repo.commit_graph"}}
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index 12c4a17234..c2f1be782a 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -47,7 +47,22 @@
{{$isHomepage := (eq $n 0)}}
- {{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}/src/{RefType}/{RefShortName}/{TreePath}"
+ "AllowCreateNewRef" .CanCreateBranch
+ }}
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
{{$cmpBranch := ""}}
{{if ne .Repository.ID .BaseRepo.ID}}
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl
index 7e13dac0dc..efaac4432a 100644
--- a/templates/repo/release/list.tmpl
+++ b/templates/repo/release/list.tmpl
@@ -12,7 +12,20 @@
{{svg "octicon-tag" 16 "tw-mr-1"}}{{$release.TagName}}
{{if and $release.Sha1 ($.Permission.CanRead ctx.Consts.RepoUnitTypeCode)}}
{{svg "octicon-git-commit" 16 "tw-mr-1"}}{{ShortSha $release.Sha1}}
- {{template "repo/branch_dropdown" dict "root" $ "release" $release}}
+ {{$compareTarget := ""}}
+ {{if $release.IsDraft}}
+ {{$compareTarget = $release.Target}}
+ {{else if $release.TagName}}
+ {{$compareTarget = $release.TagName}}
+ {{else}}
+ {{$compareTarget = $release.Sha1}}
+ {{end}}
+ {{template "repo/branch_dropdown" dict
+ "Repository" $.Repository
+ "ShowTabTags" true
+ "DropdownFixedText" (ctx.Locale.Tr "repo.release.compare")
+ "RefLinkTemplate" (print "{RepoLink}/compare/{RefShortName}..." (PathEscapeSegments $compareTarget))
+ }}
{{end}}
diff --git a/web_src/js/components/RepoBranchTagSelector.vue b/web_src/js/components/RepoBranchTagSelector.vue
index 7aecb1e351..05f7b59a66 100644
--- a/web_src/js/components/RepoBranchTagSelector.vue
+++ b/web_src/js/components/RepoBranchTagSelector.vue
@@ -1,244 +1,217 @@
-
+
- {{ textReleaseCompare }}
+ {{ dropdownFixedText }}
-
+
- {{ refNameText }}
+ {{ currentRefShortName }}
@@ -263,54 +236,50 @@ export default sfc; // activate IDE's Vue plugin
-