File tree Expand file tree Collapse file tree 3 files changed +30
-20
lines changed Expand file tree Collapse file tree 3 files changed +30
-20
lines changed Original file line number Diff line number Diff line change 11{{/* Attributes:
22* ContainerClasses
33* Repository
4- * CurrentRefType: eg. "branch", "tag"
5- * CurrentRefShortName: eg. "master", "v1.0"
4+ * CurrentRefType: eg. "branch", "tag", "commit"
5+ * CurrentRefShortName: eg. "master", "v1.0", "abcdef0123"
66* CurrentTreePath
77* RefLinkTemplate: redirect to the link when a branch/tag is selected
88* RefFormActionTemplate: change the parent form's action when a branch/tag is selected
Original file line number Diff line number Diff line change 55 {{template "repo/sub_menu" .}}
66 <div class="repo-button-row">
77 <div class="repo-button-row-left">
8-
9- {{$branchDropdownCurrentRefType := "branch"}}
10- {{$branchDropdownCurrentRefShortName := .BranchName}}
11- {{if .IsViewTag}}
12- {{$branchDropdownCurrentRefType = "tag"}}
13- {{$branchDropdownCurrentRefShortName = .TagName}}
14- {{end}}
15- {{template "repo/branch_dropdown" dict
8+ {{- /* for /owner/repo/commits/branch/the-name */ -}}
9+ {{- $branchDropdownCurrentRefType := "branch" -}}
10+ {{- $branchDropdownCurrentRefShortName := .BranchName -}}
11+ {{- if .IsViewTag -}}
12+ {{- /* for /owner/repo/commits/tag/the-name */ -}}
13+ {{- $branchDropdownCurrentRefType = "tag" -}}
14+ {{- $branchDropdownCurrentRefShortName = .TagName -}}
15+ {{- else if .IsViewCommit -}}
16+ {{- /* for /owner/repo/commits/commit/000000 */ -}}
17+ {{- $branchDropdownCurrentRefType = "commit" -}}
18+ {{- $branchDropdownCurrentRefShortName = ShortSha .CommitID -}}
19+ {{- end -}}
20+ {{- template "repo/branch_dropdown" dict
1621 "Repository" .Repository
1722 "ShowTabBranches" true
1823 "ShowTabTags" true
2126 "CurrentTreePath" .TreePath
2227 "RefLinkTemplate" "{RepoLink}/commits/{RefType}/{RefShortName}/{TreePath}"
2328 "AllowCreateNewRef" .CanCreateBranch
24- }}
25-
29+ -}}
2630 <a href="{{.RepoLink}}/graph" class="ui basic small compact button">
2731 {{svg "octicon-git-branch"}}
2832 {{ctx.Locale.Tr "repo.commit_graph"}}
Original file line number Diff line number Diff line change 2424 {{template "repo/sub_menu" .}}
2525 <div class="repo-button-row">
2626 <div class="repo-button-row-left">
27- {{$branchDropdownCurrentRefType := "branch"}}
28- {{$branchDropdownCurrentRefShortName := .BranchName}}
29- {{if .IsViewTag}}
30- {{$branchDropdownCurrentRefType = "tag"}}
31- {{$branchDropdownCurrentRefShortName = .TagName}}
32- {{end}}
33- {{template "repo/branch_dropdown" dict
27+ {{- /* for repo home (default branch) and /owner/repo/src/branch/the-name */ -}}
28+ {{- $branchDropdownCurrentRefType := "branch" -}}
29+ {{- $branchDropdownCurrentRefShortName := .BranchName -}}
30+ {{- if .IsViewTag -}}
31+ {{- /* for /owner/repo/src/tag/the-name */ -}}
32+ {{- $branchDropdownCurrentRefType = "tag" -}}
33+ {{- $branchDropdownCurrentRefShortName = .TagName -}}
34+ {{- else if .IsViewCommit -}}
35+ {{- /* for /owner/repo/src/commit/000000 */ -}}
36+ {{- $branchDropdownCurrentRefType = "commit" -}}
37+ {{- $branchDropdownCurrentRefShortName = ShortSha .CommitID -}}
38+ {{- end -}}
39+ {{- template "repo/branch_dropdown" dict
3440 "Repository" .Repository
3541 "ShowTabBranches" true
3642 "ShowTabTags" true
4046 "RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}"
4147 "AllowCreateNewRef" .CanCreateBranch
4248 "ShowViewAllRefsEntry" true
43- }}
49+ - }}
4450 {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
4551 {{$cmpBranch := ""}}
4652 {{if ne .Repository.ID .BaseRepo.ID}}
You can’t perform that action at this time.
0 commit comments