diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-03 20:06:43 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-12-03 20:06:43 +0100 |
commit | 4ab5fb7f65fe8d8f0b291dbead9f0134a28eaba2 (patch) | |
tree | b4124b996c1c183cd3f5858f99760d76d66e0ff7 | |
parent | a2349050d08a009aaef0633f2f8e7fe4fb8b78df (diff) | |
download | alps-4ab5fb7f65fe8d8f0b291dbead9f0134a28eaba2.tar.gz alps-4ab5fb7f65fe8d8f0b291dbead9f0134a28eaba2.zip |
Make message view's Back link set the mailbox page
This allows to go back and forth between the mailbox view and the
message view.
References: https://todo.sr.ht/~sircmpwn/koushin/22
-rw-r--r-- | imap.go | 2 | ||||
-rw-r--r-- | public/message.html | 4 | ||||
-rw-r--r-- | server.go | 9 |
3 files changed, 9 insertions, 6 deletions
@@ -213,7 +213,7 @@ func listMessages(conn *imapclient.Client, mboxName string, page int) ([]imapMes mbox := conn.Mailbox() to := int(mbox.Messages) - page*messagesPerPage - from := to - messagesPerPage + from := to - messagesPerPage + 1 if from <= 0 { from = 1 } diff --git a/public/message.html b/public/message.html index 5c18bd0..f653057 100644 --- a/public/message.html +++ b/public/message.html @@ -3,7 +3,9 @@ <h1>koushin</h1> <p> - <a href="/mailbox/{{.Mailbox.Name | pathescape}}">Back</a> + <a href="/mailbox/{{.Mailbox.Name | pathescape}}?page={{.MailboxPage}}"> + Back + </a> </p> <h2> @@ -203,10 +203,11 @@ func handleGetPart(ctx *context, raw bool) error { } return ctx.Render(http.StatusOK, "message.html", map[string]interface{}{ - "Mailbox": mbox, - "Message": msg, - "Body": body, - "PartPath": partPathString, + "Mailbox": mbox, + "Message": msg, + "Body": body, + "PartPath": partPathString, + "MailboxPage": (mbox.Messages - msg.SeqNum) / messagesPerPage, }) } |