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:
- +
+