forked from tangled.org/core
this repo has no description

appview: pages: pathUnscape breadcrumbs in repo/{blob,tree}

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>

anirudh.fi 0ce89997 604d1b72

verified
Changed files
+9 -4
appview
pages
templates
+5
appview/pages/funcmap.go
···
"html/template"
"log"
"math"
+
"net/url"
"path/filepath"
"reflect"
"strings"
···
},
"cssContentHash": CssContentHash,
"fileTree": filetree.FileTree,
+
"pathUnescape": func(s string) string {
+
u, _ := url.PathUnescape(s)
+
return u
+
},
}
}
+2 -2
appview/pages/templates/repo/blob.html
···
<a
href="{{ index . 1 }}"
class="text-bold text-gray-500 dark:text-gray-400 {{ $linkstyle }}"
-
>{{ index . 0 }}</a
+
>{{ pathUnescape (index . 0) }}</a
>
/
{{ else }}
<span class="text-bold text-black dark:text-white"
-
>{{ index . 0 }}</span
+
>{{ pathUnescape (index . 0) }}</span
>
{{ end }}
{{ end }}
+2 -2
appview/pages/templates/repo/tree.html
···
-
{{ define "title"}}{{ range .BreadCrumbs }}{{ index . 0}}/{{ end }} at {{ .Ref }} &middot; {{ .RepoInfo.FullName }}{{ end }}
+
{{ define "title"}}{{ range .BreadCrumbs }}{{ pathUnescape (index . 0)}}/{{ end }} at {{ .Ref }} &middot; {{ .RepoInfo.FullName }}{{ end }}
{{ define "extrameta" }}
···
<div class="flex flex-col md:flex-row md:justify-between gap-2">
<div id="breadcrumbs" class="overflow-x-auto whitespace-nowrap text-gray-400 dark:text-gray-500">
{{ range .BreadCrumbs }}
-
<a href="{{ index . 1}}" class="text-bold text-gray-500 dark:text-gray-400 {{ $linkstyle }}">{{ index . 0 }}</a> /
+
<a href="{{ index . 1}}" class="text-bold text-gray-500 dark:text-gray-400 {{ $linkstyle }}">{{ pathUnescape (index . 0) }}</a> /
{{ end }}
</div>
<div id="dir-info" class="text-gray-500 dark:text-gray-400 text-xs md:text-sm flex flex-wrap items-center gap-1 md:gap-0">