delete button works, server returns 302 over 301 so browser cache is less bad, ui sorts filetree alpha by title
parent
e025f3835a
commit
51bd874063
|
|
@ -312,7 +312,7 @@ func (server *Server) uiSubTemplates() (*template.Template, error) {
|
|||
}
|
||||
|
||||
func (server *Server) rootHandler(w http.ResponseWriter, r *http.Request) error {
|
||||
http.Redirect(w, r, "/ui/files/"+uuid.New().String()[:5], 301)
|
||||
http.Redirect(w, r, "/ui/files/"+uuid.New().String()[:5], 302)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
todo:
|
||||
- hide checkbox for tree
|
||||
- delete button does nothing
|
||||
- do not rewrite .md title vs. link cause hrefs to ./gobs.md wont work
|
||||
- https://codepen.io/bisserof/pen/nrMveb
|
||||
- alert box; https://concisecss.com/documentation/ui
|
||||
- scrape odo
|
||||
- only one scroll bar
|
||||
- scrape gdoc
|
||||
- hide checkbox for tree
|
||||
- scrape gsheet
|
||||
- scrape gslide
|
||||
- anchor links work
|
||||
|
|
@ -14,6 +11,9 @@ 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:
|
||||
- only one scroll bar
|
||||
- https://codepen.io/bisserof/pen/nrMveb
|
||||
- delete button does nothing
|
||||
- search page tree is empty
|
||||
- highlight current page
|
||||
- fix links
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
function pushFile() {
|
||||
const title = document.getElementById("title").innerHTML ? document.getElementById("title").innerHTML : ""
|
||||
const body = easyMDE.value() ? easyMDE.value() : ""
|
||||
const id = window.location.pathname.includes("/ui/files/") ? window.location.pathname.split("/ui/files/")[1] : ""
|
||||
const id = {{ js .This.ID }}
|
||||
headers = {}
|
||||
if (title)
|
||||
headers["Title"] = title
|
||||
|
|
@ -59,6 +59,17 @@
|
|||
saveFeedbackInterval = setTimeout(() => {document.getElementById("saveFeedback").innerHTML = ""}, 5000)
|
||||
}, body, headers)
|
||||
}
|
||||
function deleteFile() {
|
||||
const id = {{ js .This.ID }}
|
||||
const pid = {{ js .This.PID }}
|
||||
http("DELETE", "/api/v0/files/" + id, (body, status) => {
|
||||
if (status != 200) {
|
||||
alert(`failed to delete file ${id}: ${status}: ${body}`)
|
||||
throw `failed to delete file ${id}: ${status}: ${body}`
|
||||
}
|
||||
window.location.href = `${window.location.protocol}\/\/${window.location.host}/ui/files/${pid}`
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<div class="fullscreen tb_fullscreen">
|
||||
<article id="article">
|
||||
|
|
@ -76,8 +87,8 @@
|
|||
</span>
|
||||
<span id="title" class="thic_flex" contenteditable>{{ .This.Title }}</span>
|
||||
<span class="l_buffer">
|
||||
<form action="" method="delete" onsubmit="return confirm('are you sure?');"> <!-- TODO -->
|
||||
<input class="button-error lil_btn" type="submit" value="DELETE"/>
|
||||
<form onsubmit="deleteFile(); return false;"> <!-- TODO -->
|
||||
<input class="button-error lil_btn" type="submit" onclick="confirm('are you sure?');" value="DELETE"/>
|
||||
</form>
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -52,12 +52,14 @@
|
|||
function branchesHTML(id, branches) {
|
||||
if (!branchesHaveContent(branches))
|
||||
return ""
|
||||
var html = []
|
||||
var out = ``
|
||||
for(var i in branches) {
|
||||
out += `<details open>`
|
||||
out += branchHTML(i, branches[i])
|
||||
out += `</details>`
|
||||
html.push([branches[i].Leaf.Title, `<details open>` + branchHTML(i, branches[i]) + `</details>`])
|
||||
}
|
||||
html.sort()
|
||||
for(var i in html)
|
||||
out += html[i][1]
|
||||
return out
|
||||
}
|
||||
function branchesHaveContent(branches) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue