when editing events, preserve time
Ted Unangst tedu@tedunangst.com
Mon, 16 Dec 2019 17:49:34 -0500
2 files changed,
14 insertions(+),
4 deletions(-)
M
views/honkform.html
→
views/honkform.html
@@ -31,11 +31,11 @@ <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"> +<div id=timedescriptor style="{{ or .ShowTime "display: none" }}"> <p><label for=timestart>start:</label><br> -<input type="text" name="timestart" value=""> +<input type="text" name="timestart" value="{{ .StartTime }}"> <p><label for=timeend>duration:</label><br> -<input type="text" name="timeend" value=""> +<input type="text" name="timeend" value="{{ .Duration }}"> </div> </details> <p>
M
web.go
→
web.go
@@ -1351,7 +1351,12 @@ templinfo["Honks"] = honks
templinfo["MapLink"] = getmaplink(u) templinfo["Noise"] = noise templinfo["SavedPlace"] = honk.Place - templinfo["ServerMessage"] = "honk edit" + if tm := honk.Time; tm != nil { + templinfo["ShowTime"] = ";" + templinfo["StartTime"] = tm.StartTime.Format("2006-01-02 03:04") + templinfo["Duration"] = tm.Duration + } + templinfo["ServerMessage"] = "honk edit 2" templinfo["IsPreview"] = true templinfo["UpdateXID"] = honk.XID if len(honk.Donks) > 0 {@@ -1638,6 +1643,11 @@ templinfo["MapLink"] = getmaplink(userinfo)
templinfo["InReplyTo"] = r.FormValue("rid") templinfo["Noise"] = r.FormValue("noise") templinfo["SavedFile"] = donkxid + if tm := honk.Time; tm != nil { + templinfo["ShowTime"] = ";" + templinfo["StartTime"] = tm.StartTime.Format("2006-01-02 03:04") + templinfo["Duration"] = tm.Duration + } templinfo["IsPreview"] = true templinfo["UpdateXID"] = updatexid templinfo["ServerMessage"] = "honk preview"