{{$isTreePathRoot := not .TreeNames}}
{{/* {{template "repo/sub_menu" .}} */}}
{{if not $isTreePathRoot}} {{end}} {{template "repo/branch_dropdown" dict "Repository" .Repository "ShowTabBranches" true "ShowTabTags" true "CurrentRefType" .RefFullName.RefType "CurrentRefShortName" .RefFullName.ShortName "CurrentTreePath" .TreePath "RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}" "AllowCreateNewRef" .CanCreateBranch "ShowViewAllRefsEntry" true }} {{if and $isTreePathRoot (.Permission.CanRead ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}} {{end}} {{if not $isTreePathRoot}} {{$treeNameIdxLast := Eval (len .TreeNames) "-" 1}} {{StringUtils.EllipsisString .Repository.Name 30}} {{- range $i, $v := .TreeNames -}} / {{- if eq $i $treeNameIdxLast -}} {{$v}} {{- else -}} {{$p := index $.Paths $i}}{{$v}} {{- end -}} {{- end -}} {{end}}
{{if $isTreePathRoot}} {{ctx.Locale.Tr "repo.find_file.go_to_file"}} {{end}} {{if and .RefFullName.IsBranch (not .IsViewFile)}} {{end}} {{if and $isTreePathRoot .Repository.IsTemplate}} {{ctx.Locale.Tr "repo.use_template"}} {{end}} {{if $isTreePathRoot}} {{template "repo/clone_panel" .}} {{end}} {{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} {{svg "octicon-history" 16}}{{ctx.Locale.Tr "repo.file_history"}} {{end}}
{{if .IsViewFile}} {{template "repo/view_file" .}} {{else if .IsBlame}} {{template "repo/blame" .}} {{else}}{{/* IsViewDirectory */}} {{if $isTreePathRoot}} {{template "repo/code/upstream_diverging_info" .}} {{end}} {{template "repo/view_list" .}} {{if and .ReadmeExist (or .IsMarkup .IsPlainText)}} {{template "repo/view_file" .}} {{end}} {{end}}