3 files changed,
26 insertions(+),
13 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2026-03-11 13:16:32 +0200
Authored at:
2026-03-11 12:28:50 +0200
Change ID:
zqvpyynqusnzxwvqszyxvqvrsprppklp
Parent:
af5aca1
M
internal/handlers/repo.go
路路路 111 111 } 112 112 113 113 type RepoTree struct { 114 - Desc string 115 - Ref string 116 - Tree []git.NiceTree 117 - ParentPath string 118 - DotDot string 119 - Readme template.HTML 114 + Desc string 115 + Ref string 116 + Tree []git.NiceTree 117 + Breadcrumbs []Breadcrumb 118 + ParentPath string 119 + DotDot string 120 + Readme template.HTML 120 121 } 121 122 122 123 func (h *handlers) repoTreeHandler(w http.ResponseWriter, r *http.Request) { 路路路 149 150 } 150 151 151 152 h.templ(w, "repo_tree", h.pageData(repo, RepoTree{ 152 - Desc: desc, 153 - Ref: ref, 154 - Tree: tree, 155 - ParentPath: treePath, 156 - DotDot: filepath.Dir(treePath), 157 - Readme: readme, 153 + Desc: desc, 154 + Ref: ref, 155 + Tree: tree, 156 + ParentPath: treePath, 157 + DotDot: filepath.Dir(treePath), 158 + Breadcrumbs: Breadcrumbs(treePath), 159 + Readme: readme, 158 160 })) 159 161 } 160 162
M
web/templates/repo_tree.html
路路路 10 10 {{ template "repo_header" . }} 11 11 <main> 12 12 {{ $parent := .P.ParentPath }} 13 - 13 + {{ if .P.Breadcrumbs }} 14 + <p class="mb"> 15 + <a class="link" href="/{{ $name }}/tree/{{ .P.Ref }}">{{ .RepoName }}</a> 16 + {{- range .P.Breadcrumbs -}} 17 + <span class="mode">/</span> 18 + {{- if .IsLast -}}{{- .Name -}} 19 + {{- else -}}<a class="link" href="/{{ $name }}/tree/{{ $.P.Ref }}/{{ .Path }}">{{ .Name }}</a>{{- end -}} 20 + {{- end -}} 21 + </p> 22 + {{ end }} 14 23 <table class="table tree"> 15 24 <thead> 16 25 <tr class="nohover">