highlight current path in tree

master
Bel LaPointe 2022-02-16 08:22:03 -07:00
parent a7c8a0d481
commit e025f3835a
3 changed files with 7 additions and 7 deletions

View File

@ -275,8 +275,8 @@ func (server *Server) uiFilesHandler(w http.ResponseWriter, r *http.Request) err
"This": map[string]interface{}{
"Title": leaf.Title,
"Content": leaf.Content,
"ID": id,
"PID": id.Pop(),
"ID": id.String(),
"PID": id.Pop().String(),
"PTitle": parent.Title,
},
"Tree": string(branchesJSON),

View File

@ -1,7 +1,4 @@
todo:
- convert hardcore to IDs are / so things can ignore this fact rather than partially [] and partially modified in frontend
- highlight current page
- search page tree is empty
- hide checkbox for tree
- delete button does nothing
- do not rewrite .md title vs. link cause hrefs to ./gobs.md wont work
@ -17,6 +14,8 @@ todo:
- ui; last updated; 2022.02.01T12:34:56
- mark generated via meta so other files in the dir can be created, deleted, replaced safely
done:
- search page tree is empty
- highlight current page
- fix links
- rewrite anchors (maybe gitlab already works :^))
- link to original in generated/scraped
@ -28,3 +27,4 @@ done:
- only 1 pid link in tree as title
- fix images
- breadcrumb; https://concisecss.com/documentation/ui
- convert hardcore to IDs are / so things can ignore this fact rather than partially [] and partially modified in frontend

View File

@ -42,10 +42,10 @@
const name=`filetree-leaf-${nameSafeId}`
const parentname=`filetree-leaf-${parentNameSafeId}`
const title=id ? branch.Leaf.Title : "ROOT"
const isLive = `{{ .This.ID }}`
const isLive = '{{ .This.ID }}'.slice(0, id.length) == id
return `
<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;" class="${isLive ? "button button-info button-border" : ""}">${title}</button></a>
<a href="${href}/${generateUUID().split("-")[0]}#${parentname}"><button>+</button></a>
`
}