whatdahey

master
Bel LaPointe 2022-02-16 07:57:25 -07:00
parent 9923b182f4
commit 552a3f46ff
2 changed files with 5 additions and 4 deletions

View File

@ -216,10 +216,10 @@ func (server *Server) uiSearchHandler(w http.ResponseWriter, r *http.Request) er
} }
data := make([]struct { data := make([]struct {
Title string Title string
ID string ID ID
}, len(idsTitles)) }, len(idsTitles))
for i := range idsTitles { for i := range idsTitles {
data[i].ID = idsTitles[i][0] data[i].ID = NewID(idsTitles[i][0])
data[i].Title = idsTitles[i][1] data[i].Title = idsTitles[i][1]
} }
tree := server.tree() tree := server.tree()
@ -278,8 +278,8 @@ func (server *Server) uiFilesHandler(w http.ResponseWriter, r *http.Request) err
"This": map[string]string{ "This": map[string]string{
"Title": leaf.Title, "Title": leaf.Title,
"Content": leaf.Content, "Content": leaf.Content,
"ID": r.URL.Path, "ID": ID,
"PID": strings.TrimPrefix(path.Dir(r.URL.Path), "/"), "PID": ID.Pop(),
"PTitle": parent.Title, "PTitle": parent.Title,
}, },
"Tree": string(branchesJSON), "Tree": string(branchesJSON),

View File

@ -42,6 +42,7 @@
const name=`filetree-leaf-${nameSafeId}` const name=`filetree-leaf-${nameSafeId}`
const parentname=`filetree-leaf-${parentNameSafeId}` const parentname=`filetree-leaf-${parentNameSafeId}`
const title=id ? branch.Leaf.Title : "ROOT" const title=id ? branch.Leaf.Title : "ROOT"
const isLive = `{{ .This.ID }}`
return ` return `
<div style="margin: 0; padding: 0; height: 0; width: 0;" id="${name}"></div> <div style="margin: 0; padding: 0; height: 0; width: 0;" id="${name}"></div>
<a style="flex-grow: 1;" href="${href}#${parentname}"><button style="width: 100%; text-align: left; outline: none;">${title}</button></a> <a style="flex-grow: 1;" href="${href}#${parentname}"><button style="width: 100%; text-align: left; outline: none;">${title}</button></a>