From ce0b0a7eeb35049a921e160920a7c279327db0ca Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 13 May 2020 19:42:41 +0200 Subject: plugins/caldav: add form to create new events --- plugins/caldav/plugin.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'plugins/caldav/plugin.go') diff --git a/plugins/caldav/plugin.go b/plugins/caldav/plugin.go index 68de6cf..caeb12a 100644 --- a/plugins/caldav/plugin.go +++ b/plugins/caldav/plugin.go @@ -2,8 +2,10 @@ package alpscaldav import ( "fmt" + "html/template" "net/http" "net/url" + "time" "git.sr.ht/~emersion/alps" ) @@ -57,6 +59,18 @@ func newPlugin(srv *alps.Server) (alps.Plugin, error) { registerRoutes(&p, u) + p.TemplateFuncs(template.FuncMap{ + "formatinputdate": func(t time.Time) string { + return t.Format("2006-01-02") + }, + "ornow": func(t time.Time) time.Time { + if t.IsZero() { + return time.Now() + } + return t + }, + }) + return p.Plugin(), nil } -- cgit v1.2.3-59-g8ed1b