expand honk form when editing or previewing

This commit is contained in:
Ted Unangst 2019-10-12 10:38:22 -04:00
parent 878c3c28e9
commit e0dab7207f
3 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,6 @@
<p id="honkformhost"> <p id="honkformhost">
<button onclick="showhonkform(); return false"><a href="/newhonk">it's honking time</a></button> <button onclick="showhonkform(); return false"><a href="/newhonk">it's honking time</a></button>
<form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" style="display: none"> <form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" {{ if not .IsPreview }}style="display: none"{{ end }}>
<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}"> <input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
<input type="hidden" name="updatexid" value = "{{ .UpdateXID }}"> <input type="hidden" name="updatexid" value = "{{ .UpdateXID }}">
<input type="hidden" name="rid" id="ridinput" value="{{ .InReplyTo }}"> <input type="hidden" name="rid" id="ridinput" value="{{ .InReplyTo }}">

View File

@ -10,7 +10,7 @@
{{ template "honkform.html" . }} {{ template "honkform.html" . }}
{{ end }} {{ end }}
</div> </div>
{{ if .HonkCSRF }} {{ if and .HonkCSRF (not .IsPreview) }}
<div class="info" id="refreshbox"> <div class="info" id="refreshbox">
<p><button onclick="refreshhonks(this)">refresh</button><span></span> <p><button onclick="refreshhonks(this)">refresh</button><span></span>
</div> </div>

1
web.go
View File

@ -959,6 +959,7 @@ func edithonkpage(w http.ResponseWriter, r *http.Request) {
templinfo["Honks"] = honks templinfo["Honks"] = honks
templinfo["Noise"] = noise templinfo["Noise"] = noise
templinfo["ServerMessage"] = "honk edit" templinfo["ServerMessage"] = "honk edit"
templinfo["IsPreview"] = true
templinfo["UpdateXID"] = honk.XID templinfo["UpdateXID"] = honk.XID
if len(honk.Donks) > 0 { if len(honk.Donks) > 0 {
templinfo["SavedFile"] = honk.Donks[0].XID templinfo["SavedFile"] = honk.Donks[0].XID