honk/views/honkpage.html

50 lines
1.1 KiB
HTML
Raw Normal View History

2019-04-09 13:59:33 +02:00
{{ template "header.html" . }}
<div class="center">
2019-04-23 17:22:31 +02:00
<div class="info" id="infobox">
2019-04-09 13:59:33 +02:00
{{ if .Name }}
<p>{{ .Name }} <span style="margin-left:1em;"><a href="/u/{{ .Name }}/rss">rss</a></span>
{{ if .HonkCSRF }}
<div>
<form id="aboutform" action="/saveuser" method="POST">
<input type="hidden" name="CSRF" value="{{ .UserCSRF }}">
<textarea name="whatabout">{{ .RawWhatAbout }}</textarea>
<p>
<input type="submit" value="update">
</form>
</div>
{{ else }}
<p>{{ .WhatAbout }}
{{ end }}
{{ end }}
2019-04-23 17:22:31 +02:00
<p>{{ .ServerMessage }}
{{ if .HonkCSRF }}
{{ template "honkform.html" . }}
{{ end }}
</div>
2019-04-09 13:59:33 +02:00
<div>
2019-04-23 17:22:31 +02:00
{{ $BonkCSRF := .HonkCSRF }}
2019-04-09 13:59:33 +02:00
{{ range .Honks }}
2019-04-23 17:22:31 +02:00
{{ template "honk.html" map "Honk" . "Bonk" $BonkCSRF }}
2019-04-09 13:59:33 +02:00
{{ end }}
</div>
2019-04-23 17:22:31 +02:00
{{ if $BonkCSRF }}
<script>
function post(url, data) {
var x = new XMLHttpRequest()
x.open("POST", url)
x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
x.send(data)
}
function bonk(el, xid) {
el.innerHTML = "bonked"
el.disabled = true
post("/bonk", "CSRF={{ $BonkCSRF }}&xid=" + xid)
}
function zonkit(el, xid) {
el.innerHTML = "zonked"
el.disabled = true
post("/zonkit", "CSRF={{ $BonkCSRF }}&xid=" + xid)
}
</script>
{{ end }}