From 34dc5b1c1d3e69696fb20e3bc73e53f6ec45d696 Mon Sep 17 00:00:00 2001 From: Kerwin Bryant Date: Fri, 10 Jan 2025 02:02:46 +0000 Subject: [PATCH] Merge branch 'main' into add-file-tree-to-file-view-page --- templates/repo/home_branch_dropdown.tmpl | 18 ++++++++++++------ templates/repo/view_file_tree_sidebar.tmpl | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/templates/repo/home_branch_dropdown.tmpl b/templates/repo/home_branch_dropdown.tmpl index eea8abbbf4..08255f482b 100644 --- a/templates/repo/home_branch_dropdown.tmpl +++ b/templates/repo/home_branch_dropdown.tmpl @@ -1,9 +1,15 @@ -{{$branchDropdownCurrentRefType := "branch"}} -{{$branchDropdownCurrentRefShortName := .ctxData.BranchName}} -{{if .ctxData.IsViewTag}} - {{$branchDropdownCurrentRefType = "tag"}} - {{$branchDropdownCurrentRefShortName = .ctxData.TagName}} -{{end}} +{{- /* for repo home (default branch) and /owner/repo/src/branch/the-name */ -}} +{{- $branchDropdownCurrentRefType := "branch" -}} +{{- $branchDropdownCurrentRefShortName := .ctxData.BranchName -}} +{{- if .IsViewTag -}} + {{- /* for /owner/repo/src/tag/the-name */ -}} + {{- $branchDropdownCurrentRefType = "tag" -}} + {{- $branchDropdownCurrentRefShortName = .ctxData.TagName -}} +{{- else if .IsViewCommit -}} + {{- /* for /owner/repo/src/commit/000000 */ -}} + {{- $branchDropdownCurrentRefType = "commit" -}} + {{- $branchDropdownCurrentRefShortName = ShortSha .ctxData.CommitID -}} +{{- end -}} {{template "repo/branch_dropdown" dict "Repository" .ctxData.Repository "ShowTabBranches" true diff --git a/templates/repo/view_file_tree_sidebar.tmpl b/templates/repo/view_file_tree_sidebar.tmpl index f52e17fdef..0c9e1816d1 100644 --- a/templates/repo/view_file_tree_sidebar.tmpl +++ b/templates/repo/view_file_tree_sidebar.tmpl @@ -1,9 +1,15 @@ -{{$branchDropdownCurrentRefType := "branch"}} -{{$branchDropdownCurrentRefShortName := .BranchName}} -{{if .IsViewTag}} - {{$branchDropdownCurrentRefType = "tag"}} - {{$branchDropdownCurrentRefShortName = .TagName}} -{{end}} +{{- /* 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 -}}