aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2019-12-03 14:33:20 +0100
committerSimon Ser <contact@emersion.fr>2019-12-03 14:34:15 +0100
commit9f6b086f62c9da8901d3f021aa65cc13661e1e45 (patch)
treedfcd94a7962e3c9c4c1b47ca60077a2268c2ebf7
parente62b48caa8e7664ffbed41e9f7c10b90f18fca8b (diff)
downloadalps-9f6b086f62c9da8901d3f021aa65cc13661e1e45.tar.gz
alps-9f6b086f62c9da8901d3f021aa65cc13661e1e45.zip
Add compose view
-rw-r--r--public/compose.html24
-rw-r--r--public/mailbox.html4
-rw-r--r--public/message.html4
-rw-r--r--server.go8
4 files changed, 38 insertions, 2 deletions
diff --git a/public/compose.html b/public/compose.html
new file mode 100644
index 0000000..8253eeb
--- /dev/null
+++ b/public/compose.html
@@ -0,0 +1,24 @@
+{{template "head"}}
+
+<h1>koushin</h1>
+
+<p>
+ <a href="/mailbox/INBOX">Back</a>
+</p>
+
+<h2>Compose new message</h2>
+
+<form method="post" action="/compose">
+ <p>From:</p>
+ <input type="text" name="from">
+ <p>To:</p>
+ <input type="text" name="to">
+ <p>Subject:</p>
+ <input type="text" name="subject">
+ <p>Body:</p>
+ <textarea name="text" cols="80" rows="20"></textarea>
+ <br><br>
+ <input type="submit" value="Send">
+</form>
+
+{{template "foot"}}
diff --git a/public/mailbox.html b/public/mailbox.html
index c4ff097..303bdb4 100644
--- a/public/mailbox.html
+++ b/public/mailbox.html
@@ -2,7 +2,9 @@
<h1>koushin</h1>
-<a href="/logout">Logout</a>
+<p>
+ <a href="/logout">Logout</a> ยท <a href="/compose">Compose</a>
+</p>
<h2>{{.Mailbox.Name}}</h2>
diff --git a/public/message.html b/public/message.html
index 09e56ac..cb9518b 100644
--- a/public/message.html
+++ b/public/message.html
@@ -2,7 +2,9 @@
<h1>koushin</h1>
-<a href="/mailbox/{{.Mailbox.Name}}">Back</a>
+<p>
+ <a href="/mailbox/{{.Mailbox.Name}}">Back</a>
+</p>
<h2>{{.Message.Envelope.Subject}}</h2>
diff --git a/server.go b/server.go
index c6d61e8..4156724 100644
--- a/server.go
+++ b/server.go
@@ -154,6 +154,11 @@ func handleGetPart(ctx *context, raw bool) error {
})
}
+func handleCompose(ectx echo.Context) error {
+ ctx := ectx.(*context)
+ return ctx.Render(http.StatusOK, "compose.html", nil)
+}
+
func New(imapURL string) *echo.Echo {
e := echo.New()
@@ -247,6 +252,9 @@ func New(imapURL string) *echo.Echo {
return ctx.Redirect(http.StatusFound, "/login")
})
+ e.GET("/compose", handleCompose)
+ e.POST("/compose", handleCompose)
+
e.Static("/assets", "public/assets")
return e