Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Jan 9, 2025
1 parent 7706924 commit 90b5aef
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
26 changes: 14 additions & 12 deletions templates/repo/commits.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
{{template "repo/sub_menu" .}}
<div class="repo-button-row">
<div class="repo-button-row-left">

{{$branchDropdownCurrentRefType := "branch"}}
{{$branchDropdownCurrentRefShortName := .RefName}}
{{if .IsViewTag}}
{{$branchDropdownCurrentRefType = "tag"}}
{{$branchDropdownCurrentRefShortName = .TagName}}
{{else if not .IsViewBranch}}
{{$branchDropdownCurrentRefShortName = ShortSha .RefName}}
{{end}}
{{template "repo/branch_dropdown" dict
{{- /* 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
Expand All @@ -23,8 +26,7 @@
"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"}}
Expand Down
24 changes: 14 additions & 10 deletions templates/repo/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@
{{template "repo/sub_menu" .}}
<div class="repo-button-row">
<div class="repo-button-row-left">
{{$branchDropdownCurrentRefType := "branch"}}
{{$branchDropdownCurrentRefShortName := .RefName}}
{{if .IsViewTag}}
{{$branchDropdownCurrentRefType = "tag"}}
{{$branchDropdownCurrentRefShortName = .TagName}}
{{else if not .IsViewBranch}}
{{$branchDropdownCurrentRefShortName = ShortSha .RefName}}
{{end}}
{{template "repo/branch_dropdown" dict
{{- /* for repo home (default branch) and /owner/repo/src/branch/the-name */ -}}
{{- $branchDropdownCurrentRefType := "branch" -}}
{{- $branchDropdownCurrentRefShortName := .BranchName -}}
{{- if .IsViewTag -}}
{{- /* for /owner/repo/src/tag/the-name */ -}}
{{- $branchDropdownCurrentRefType = "tag" -}}
{{- $branchDropdownCurrentRefShortName = .TagName -}}
{{- else if .IsViewCommit -}}
{{- /* for /owner/repo/src/commit/000000 */ -}}
{{- $branchDropdownCurrentRefType = "commit" -}}
{{- $branchDropdownCurrentRefShortName = ShortSha .CommitID -}}
{{- end -}}
{{- template "repo/branch_dropdown" dict
"Repository" .Repository
"ShowTabBranches" true
"ShowTabTags" true
Expand All @@ -42,7 +46,7 @@
"RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}"
"AllowCreateNewRef" .CanCreateBranch
"ShowViewAllRefsEntry" true
}}
-}}
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
{{$cmpBranch := ""}}
{{if ne .Repository.ID .BaseRepo.ID}}
Expand Down

0 comments on commit 90b5aef

Please sign in to comment.