all repos — honk @ v0.1.2

my fork of honk

views/homepage.html (view raw)

 1{{ template "header.html" . }}
 2<div class="center">
 3<div class="info">
 4<p>{{ .ServerMessage }}
 5{{ if .HonkCSRF }}
 6{{ template "honkform.html" . }}
 7{{ end }}
 8</div>
 9<div>
10{{ $BonkCSRF := .HonkCSRF }}
11{{ range .Honks }}
12{{ template "honk.html" map "Honk" . "Bonk" $BonkCSRF }}
13{{ end }}
14</div>
15{{ if $BonkCSRF }}
16<script>
17function post(url, data) {
18	var x = new XMLHttpRequest()
19	x.open("POST", url)
20	x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
21	x.send(data)
22}
23function bonk(xid) {
24	post("/bonk", "CSRF={{ $BonkCSRF }}&xid=" + xid)
25}
26</script>
27{{ end }}