{{define "webmail_folder.html"}} {{if .search_query}}Search: {{.search_query}}{{else}}{{.active_folder}}{{end}} - Webmail {{template "csrf_script" .}}
{{range .flashes}} {{end}}
Folders
{{range .folder_tree}}{{template "folderTreeNode" .}}{{end}}
Right-click a folder for more actions
{{if not .search_query}} {{end}}
{{if .search_query}}Search: “{{.search_query}}”{{else}}{{.active_folder}}{{end}} {{.total}} message{{if ne .total 1}}s{{end}}
{{if .messages}} {{range .messages}} {{$rowHref := printf "/webmail/mail/%s/%d" .Folder .ID}} {{$paneHref := printf "/webmail/mail/%s/%d/pane" .Folder .ID}} {{$isDraft := eq .Folder "Drafts"}} {{if $isDraft}}{{$rowHref = printf "/webmail/mail/compose?draft=%d&folder=Drafts" .ID}}{{end}} {{$displayName := senderName .CachedFrom}} {{if eq .Folder "Sent"}}{{if .CachedTo}}{{$displayName = senderName .CachedTo}}{{else}}{{$displayName = "(no recipient)"}}{{end}}{{end}}
{{initial $displayName}}
{{$displayName}} {{strftime "%Y-%m-%d %H:%M" .InternalDate}}
{{if .CachedSubject}}{{.CachedSubject}}{{else}}(no subject){{end}} {{if gt .GroupExtra 0}}+{{.GroupExtra}} more{{end}} {{if .CachedPreview}} – {{.CachedPreview}}{{end}}
{{end}} {{else}}
No messages
{{end}}
{{if or .has_prev .has_next}}
{{if .has_prev}}« Newer{{else}}{{end}} {{if .has_next}}Older »{{end}}
{{end}}

Select a message to read

{{/* Always rendered (independent of search-mode, unlike the bulk toolbar's own Move-to dropdown) so the message context menu's Move-to submenu always has a folder list to build from, search results included. */}}
{{template "compose_widget" .}} {{template "webmail_shortcuts" .}} {{end}} {{/* folderTreeNode renders one sidebar folder row plus (if any) its children, recursing into itself for each child — . is a *folderViewNode (webmail_mail.go's buildFolderView), which carries everything needed (icon, counts, active state, renameable/can-add-child/is-spam/is-trash) precomputed, so no shared state needs threading through the recursion beyond the node itself. */}} {{define "folderTreeNode"}}
{{if .Children}} {{else}} {{end}} {{if .Renameable}}{{end}} {{if isStandardFolder .Name}}{{end}}{{.Name}} {{if .Total}} {{.Total}}{{if .Unread}} / {{.Unread}}{{end}} {{end}} {{if .Renameable}}
{{end}}
{{if .Children}}
{{range .Children}}{{template "folderTreeNode" .}}{{end}}
{{end}} {{end}}