filer: UI ensure a correct foler link

This commit is contained in:
Chris Lu 2019-12-11 23:09:01 -08:00
parent 4cba32d1d0
commit 1f400489c6
2 changed files with 8 additions and 4 deletions

View file

@ -14,10 +14,14 @@ func ToBreadcrumb(fullpath string) (crumbs []Breadcrumb) {
parts := strings.Split(fullpath, "/") parts := strings.Split(fullpath, "/")
for i := 0; i < len(parts); i++ { for i := 0; i < len(parts); i++ {
crumbs = append(crumbs, Breadcrumb{ crumb := Breadcrumb{
Name: parts[i] + "/", Name: parts[i] + " /",
Link: "/" + filepath.ToSlash(filepath.Join(parts[0:i+1]...)), Link: "/" + filepath.ToSlash(filepath.Join(parts[0:i+1]...)),
}) }
if !strings.HasSuffix(crumb.Link, "/") {
crumb.Link += "/"
}
crumbs = append(crumbs, crumb)
} }
return return

View file

@ -50,7 +50,7 @@ var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOC
<div class="row"> <div class="row">
<div> <div>
{{ range $entry := .Breadcrumbs }} {{ range $entry := .Breadcrumbs }}
<a href={{ $entry.Link }} > <a href="{{ $entry.Link }}" >
{{ $entry.Name }} {{ $entry.Name }}
</a> </a>
{{ end }} {{ end }}