summaryrefslogtreecommitdiff
path: root/actions.go
diff options
context:
space:
mode:
Diffstat (limited to 'actions.go')
-rw-r--r--actions.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/actions.go b/actions.go
new file mode 100644
index 0000000..fde767c
--- /dev/null
+++ b/actions.go
@@ -0,0 +1,30 @@
+package main
+
+import (
+ "github.com/Masterminds/sprig"
+ "os"
+ "text/template"
+)
+
+func WithdrawMotion(decision *Decision, voter *Voter) (err error) {
+ // load template, fill name, tag, title, content
+ type mailContext struct {
+ *Decision
+ Name string
+ Sender string
+ Recipient string
+ }
+ context := mailContext{decision, voter.Name, config.NoticeSenderAddress, config.BoardMailAddress}
+
+ // fill withdraw_mail.txt
+ t, err := template.New("withdraw_mail.txt").Funcs(
+ sprig.GenericFuncMap()).ParseFiles("templates/withdraw_mail.txt")
+ if err != nil {
+ logger.Fatal(err)
+ }
+ // TODO: send mail
+ t.Execute(os.Stdout, context)
+
+ // TODO: implement call decision.Close()
+ return
+}