improve editing operation wrt attachments and places
Ted Unangst tedu@tedunangst.com
Wed, 23 Oct 2019 00:45:12 -0400
3 files changed,
15 insertions(+),
2 deletions(-)
M
views/honkform.html
→
views/honkform.html
@@ -9,10 +9,19 @@ <p>
<details> <summary>more options</summary> <p> -<label class=button id="donker">attach: {{ if .SavedFile }} {{ .SavedFile }} {{ else }} <input onchange="updatedonker();" type="file" name="donk"><span></span> {{ end }}</label> -<input type="hidden" name="donkxid" value="{{ .SavedFile }}"> +<label class=button id="donker">attach: <input onchange="updatedonker();" type="file" name="donk"><span>{{ .SavedFile }}</span></label> +<input type="hidden" id="saveddonkxid" name="donkxid" value="{{ .SavedFile }}"> <p id="donkdescriptor"><label for=donkdesc>description:</label><br> <input type="text" name="donkdesc" value="{{ .DonkDesc }}" autocomplete=off> +{{ with .SavedPlace }} +<p><button id=checkinbutton type=button onclick="fillcheckin()">checkin</button> +<div id=placedescriptor> + <p><label>name:</label><br><input type="text" name="placename" id=placenameinput value="{{ .Name }}"> + <p><label>url:</label><br><input type="text" name="placeurl" id=placeurlinput value="{{ .Url }}"> + <p><label>lat: </label><input type="text" size=9 name="placelat" id=placelatinput value="{{ .Latitude}}"> + <label>lon: </label><input type="text" size=9 name="placelong" id=placelonginput value="{{ .Longitude }}"> +</div> +{{ else }} <p><button id=checkinbutton type=button onclick="fillcheckin()">checkin</button> <div id=placedescriptor style="display: none"> <p><label>name:</label><br><input type="text" name="placename" id=placenameinput value="">@@ -20,6 +29,7 @@ <p><label>url:</label><br><input type="text" name="placeurl" id=placeurlinput value="">
<p><label>lat: </label><input type="text" size=9 name="placelat" id=placelatinput value=""> <label>lon: </label><input type="text" size=9 name="placelong" id=placelonginput value=""> </div> +{{ end }} <p><button id=addtimebutton type=button onclick="showelement('timedescriptor')">add time</button> <div id=timedescriptor style="display: none"> <p><label for=timestart>start:</label><br>
M
views/honkpage.js
→
views/honkpage.js
@@ -270,6 +270,8 @@ var el = document.getElementById("donker")
el.children[1].textContent = el.children[0].value.slice(-20) var el = document.getElementById("donkdescriptor") el.style.display = "" + var el = document.getElementById("saveddonkxid") + el.value = "" } var checkinprec = 100.0 var gpsoptions = {
M
web.go
→
web.go
@@ -980,6 +980,7 @@ templinfo := getInfo(r)
templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) templinfo["Honks"] = honks templinfo["Noise"] = noise + templinfo["SavedPlace"] = honk.Place templinfo["ServerMessage"] = "honk edit" templinfo["IsPreview"] = true templinfo["UpdateXID"] = honk.XID