From c9075e46ff74b272ee86abad876cfdf49e0fd5c1 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 26 Apr 2019 09:07:13 -0400 Subject: [PATCH] add more kill controls --- honk.go | 27 ++++++++++++++++++++++++--- views/honk.html | 18 ++++++++++++++++-- views/honkpage.html | 23 +++++++++++++++++++---- views/style.css | 7 ++++++- 4 files changed, 65 insertions(+), 10 deletions(-) diff --git a/honk.go b/honk.go index e6425cc..49cdaa5 100644 --- a/honk.go +++ b/honk.go @@ -789,11 +789,32 @@ func savebonk(w http.ResponseWriter, r *http.Request) { } func zonkit(w http.ResponseWriter, r *http.Request) { - xid := r.FormValue("xid") + wherefore := r.FormValue("wherefore") + var what string + switch wherefore { + case "this honk": + what = r.FormValue("honk") + wherefore = "zonk" + case "this honker": + what = r.FormValue("honker") + wherefore = "zonker" + case "this convoy": + what = r.FormValue("convoy") + wherefore = "zonvoy" + } + if what == "" { + return + } - log.Printf("zonking %s", xid) + log.Printf("zonking %s %s", wherefore, what) userinfo := login.GetUserInfo(r) - stmtZonkIt.Exec(userinfo.UserID, xid) + if wherefore == "zonk" { + stmtZonkIt.Exec(userinfo.UserID, what) + } else { + db := opendatabase() + db.Exec("insert into zonkers (userid, name, wherefore) values (?, ?, ?)", + userinfo.UserID, what, wherefore) + } } func savehonk(w http.ResponseWriter, r *http.Request) { diff --git a/views/honk.html b/views/honk.html index 30383ca..83aa855 100644 --- a/views/honk.html +++ b/views/honk.html @@ -25,10 +25,24 @@ convoy: {{ .Convoy }} {{ end }} {{ end }} -{{ if and .Bonk (not (eq .Honk.What "zonked")) }} +{{ if and .BonkCSRF (not (eq .Honk.What "zonked")) }}

+

- +
+ + + + + + +
+
+

{{ end }} diff --git a/views/honkpage.html b/views/honkpage.html index cb2ccc2..90a7dba 100644 --- a/views/honkpage.html +++ b/views/honkpage.html @@ -24,11 +24,19 @@

{{ $BonkCSRF := .HonkCSRF }} {{ range .Honks }} -{{ template "honk.html" map "Honk" . "Bonk" $BonkCSRF }} +{{ template "honk.html" map "Honk" . "BonkCSRF" $BonkCSRF }} {{ end }}
{{ if $BonkCSRF }} {{ end }} diff --git a/views/style.css b/views/style.css index 76eabbc..92c36e9 100644 --- a/views/style.css +++ b/views/style.css @@ -46,7 +46,7 @@ input { margin-top 1em; margin-bottom: 1em; } -button, form input[type=submit] { +button, form input[type=submit], select { font-size: 0.8em; font-family: monospace; color: #dde; @@ -150,6 +150,11 @@ button a { .zonked .noise a { color: #a79; } +.inlineform { + display: inline; +} +.inlineform select { +} img { max-width: 100% }