{{define "webmail_folder.html"}} {{if .search_query}}Search: {{.search_query}}{{else}}{{.active_folder}}{{end}} - Webmail {{template "csrf_script" .}}
{{range .flashes}} {{end}}
{{$active := .active_folder}} {{$unread := .unread_counts}} {{range .folders}}
{{.}} {{$n := index $unread .}} {{if $n}}{{$n}}{{end}} {{if not (isStandardFolder .)}}
{{end}}
{{end}}

{{if .search_query}}Search results for “{{.search_query}}” {{else}}{{.active_folder}}{{end}}
{{.total}} message{{if ne .total 1}}s{{end}}
{{if .messages}}
{{if not .search_query}}{{else}}{{end}} {{if .search_query}}{{end}} {{$folders := .folders}} {{$showFolderCol := .search_query}} {{range .messages}} {{$rowHref := printf "/webmail/mail/%s/%d" .Folder .ID}} {{if eq .Folder "Drafts"}}{{$rowHref = printf "/webmail/mail/compose?draft=%d&folder=Drafts" .ID}}{{end}} {{if $showFolderCol}}{{end}} {{end}}
{{if eq .active_folder "Sent"}}To{{else}}From{{end}}From / ToSubjectFolderDate
{{if eq .Folder "Sent"}}{{if .CachedTo}}{{.CachedTo}}{{else}}(no recipient){{end}}{{else}}{{.CachedFrom}}{{end}} {{if .CachedSubject}}{{.CachedSubject}}{{else}}(no subject){{end}} {{if gt .GroupExtra 0}}+{{.GroupExtra}} more{{end}} {{.Folder}}{{strftime "%Y-%m-%d %H:%M" .InternalDate}}
{{if or .has_prev .has_next}}
{{if .has_prev}}« Newer{{else}}{{end}} {{if .has_next}}Older »{{end}}
{{end}} {{else}}
No messages in {{.active_folder}}
{{end}}
{{template "compose_widget" .}} {{template "webmail_shortcuts" .}} {{end}}