diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 59ee9c7ad6..f2cec3bba3 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -37,24 +37,7 @@ {{svg "octicon-sidebar-collapse" 20 "icon"}} {{end}} - {{$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 - "ShowViewAllRefsEntry" true - "ContainerClasses" (Iif $hasAndShowTreeSidebar "tw-hidden" "") - }} + {{template "repo/home_branch_dropdown" (dict "ctxData" . "containerClasses" (Iif $hasAndShowTreeSidebar "tw-hidden" ""))}} {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} {{$cmpBranch := ""}} {{if ne .Repository.ID .BaseRepo.ID}} diff --git a/templates/repo/home_branch_dropdown.tmpl b/templates/repo/home_branch_dropdown.tmpl new file mode 100644 index 0000000000..eea8abbbf4 --- /dev/null +++ b/templates/repo/home_branch_dropdown.tmpl @@ -0,0 +1,18 @@ +{{$branchDropdownCurrentRefType := "branch"}} +{{$branchDropdownCurrentRefShortName := .ctxData.BranchName}} +{{if .ctxData.IsViewTag}} + {{$branchDropdownCurrentRefType = "tag"}} + {{$branchDropdownCurrentRefShortName = .ctxData.TagName}} +{{end}} +{{template "repo/branch_dropdown" dict + "Repository" .ctxData.Repository + "ShowTabBranches" true + "ShowTabTags" true + "CurrentRefType" $branchDropdownCurrentRefType + "CurrentRefShortName" $branchDropdownCurrentRefShortName + "CurrentTreePath" .ctxData.TreePath + "RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}" + "AllowCreateNewRef" .ctxData.CanCreateBranch + "ShowViewAllRefsEntry" true + "ContainerClasses" .containerClasses +}} diff --git a/templates/repo/view_file_tree_sidebar.tmpl b/templates/repo/view_file_tree_sidebar.tmpl index 6537fa114b..0bddabfb26 100644 --- a/templates/repo/view_file_tree_sidebar.tmpl +++ b/templates/repo/view_file_tree_sidebar.tmpl @@ -13,17 +13,7 @@ Files