File tree 3 files changed +30
-20
lines changed
3 files changed +30
-20
lines changed Original file line number Diff line number Diff line change 1
1
{{/* Attributes:
2
2
* ContainerClasses
3
3
* 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"
6
6
* CurrentTreePath
7
7
* RefLinkTemplate: redirect to the link when a branch/tag is selected
8
8
* RefFormActionTemplate: change the parent form's action when a branch/tag is selected
Original file line number Diff line number Diff line change 5
5
{{template "repo/sub_menu" .}}
6
6
<div class="repo-button-row">
7
7
<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
16
21
"Repository" .Repository
17
22
"ShowTabBranches" true
18
23
"ShowTabTags" true
21
26
"CurrentTreePath" .TreePath
22
27
"RefLinkTemplate" "{RepoLink}/commits/{RefType}/{RefShortName}/{TreePath}"
23
28
"AllowCreateNewRef" .CanCreateBranch
24
- }}
25
-
29
+ -}}
26
30
<a href="{{.RepoLink}}/graph" class="ui basic small compact button">
27
31
{{svg "octicon-git-branch"}}
28
32
{{ctx.Locale.Tr "repo.commit_graph"}}
Original file line number Diff line number Diff line change 24
24
{{template "repo/sub_menu" .}}
25
25
<div class="repo-button-row">
26
26
<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
34
40
"Repository" .Repository
35
41
"ShowTabBranches" true
36
42
"ShowTabTags" true
40
46
"RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}"
41
47
"AllowCreateNewRef" .CanCreateBranch
42
48
"ShowViewAllRefsEntry" true
43
- }}
49
+ - }}
44
50
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
45
51
{{$cmpBranch := ""}}
46
52
{{if ne .Repository.ID .BaseRepo.ID}}
You can’t perform that action at this time.
0 commit comments