This allows to go back and forth between the mailbox view and the message view. References: https://todo.sr.ht/~sircmpwn/koushin/22master
@@ -213,7 +213,7 @@ func listMessages(conn *imapclient.Client, mboxName string, page int) ([]imapMes | |||||
mbox := conn.Mailbox() | mbox := conn.Mailbox() | ||||
to := int(mbox.Messages) - page*messagesPerPage | to := int(mbox.Messages) - page*messagesPerPage | ||||
from := to - messagesPerPage | |||||
from := to - messagesPerPage + 1 | |||||
if from <= 0 { | if from <= 0 { | ||||
from = 1 | from = 1 | ||||
} | } | ||||
@@ -3,7 +3,9 @@ | |||||
<h1>koushin</h1> | <h1>koushin</h1> | ||||
<p> | <p> | ||||
<a href="/mailbox/{{.Mailbox.Name | pathescape}}">Back</a> | |||||
<a href="/mailbox/{{.Mailbox.Name | pathescape}}?page={{.MailboxPage}}"> | |||||
Back | |||||
</a> | |||||
</p> | </p> | ||||
<h2> | <h2> | ||||
@@ -203,10 +203,11 @@ func handleGetPart(ctx *context, raw bool) error { | |||||
} | } | ||||
return ctx.Render(http.StatusOK, "message.html", map[string]interface{}{ | 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, | |||||
}) | }) | ||||
} | } | ||||