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
This commit is contained in:
parent
a2349050d0
commit
4ab5fb7f65
3 changed files with 9 additions and 6 deletions
2
imap.go
2
imap.go
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue