Add compose view
This commit is contained in:
parent
e62b48caa8
commit
9f6b086f62
4 changed files with 38 additions and 2 deletions
24
public/compose.html
Normal file
24
public/compose.html
Normal file
|
@ -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"}}
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue