From 423d0180593fad039a6b420fab85ff222c48733f Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Sun, 16 Jun 2019 14:11:23 -0400 Subject: [PATCH] preview button now that there's more things that can go wrong --- docs/changelog.txt | 2 ++ honk.go | 15 +++++++++++++++ views/honkform.html | 6 ++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index cf0feec..7115e39 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -2,6 +2,8 @@ changelog -- v +++ Preview before honking. + + Misc UI touchups. + Read only support for qonks. diff --git a/honk.go b/honk.go index 17d2b75..d8d2d18 100644 --- a/honk.go +++ b/honk.go @@ -946,6 +946,7 @@ func savehonk(w http.ResponseWriter, r *http.Request) { d.Name = name d.Media = media d.URL = url + d.Local = true honk.Donks = append(honk.Donks, &d) } herd := herdofemus(honk.Noise) @@ -963,6 +964,20 @@ func savehonk(w http.ResponseWriter, r *http.Request) { if !honk.Public { whofore = 3 } + if r.FormValue("preview") == "preview" { + honks := []*Honk{ &honk } + reverbolate(honks) + templinfo := getInfo(r) + templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) + templinfo["Honks"] = honks + templinfo["Noise"] = r.FormValue("noise") + templinfo["ServerMessage"] = "honk preview" + err := readviews.Execute(w, "honkpage.html", templinfo) + if err != nil { + log.Print(err) + } + return + } res, err := stmtSaveHonk.Exec(userinfo.UserID, what, honk.Honker, xid, rid, dt.Format(dbtimeformat), "", aud, noise, convoy, whofore, "html", honk.Precis, honk.Oonker) if err != nil { diff --git a/views/honkform.html b/views/honkform.html index c54932d..95977e3 100644 --- a/views/honkform.html +++ b/views/honkform.html @@ -7,9 +7,10 @@ in reply to:

- +

+