diff --git a/spike/review/reinvent/ezmded/server/server.go b/spike/review/reinvent/ezmded/server/server.go index ef75a9f..91df9c9 100644 --- a/spike/review/reinvent/ezmded/server/server.go +++ b/spike/review/reinvent/ezmded/server/server.go @@ -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 } diff --git a/spike/review/reinvent/ezmded/server/todo.yaml b/spike/review/reinvent/ezmded/server/todo.yaml index c6e1892..a4be8bf 100644 --- a/spike/review/reinvent/ezmded/server/todo.yaml +++ b/spike/review/reinvent/ezmded/server/todo.yaml @@ -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 diff --git a/spike/review/reinvent/ezmded/ui/templates/_editor.ctmpl b/spike/review/reinvent/ezmded/ui/templates/_editor.ctmpl index c612f1c..5f7e35e 100644 --- a/spike/review/reinvent/ezmded/ui/templates/_editor.ctmpl +++ b/spike/review/reinvent/ezmded/ui/templates/_editor.ctmpl @@ -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}` + }) + }