Simplify archive preview header

This commit is contained in:
DonVoo 2026-07-13 07:58:35 +02:00
parent 8823b431f4
commit 31419696df

View file

@ -97,7 +97,7 @@ func targetSelectHandler(w http.ResponseWriter, r *http.Request) {
func sourceSelectHandler(w http.ResponseWriter, r *http.Request) { func sourceSelectHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8") w.Header().Set("Content-Type", "text/html; charset=utf-8")
fmt.Fprint(w, renderInitialSourceSelectPane(`<div class="ef-empty">Nachricht waehlen.</div>`)) fmt.Fprint(w, renderInitialReadPane(`<div class="ef-empty">Nachricht waehlen.</div>`))
} }
func forwardHandler(w http.ResponseWriter, r *http.Request) { func forwardHandler(w http.ResponseWriter, r *http.Request) {
@ -307,12 +307,7 @@ func renderReadPaneWithSource(w http.ResponseWriter, account, folder, targetAcco
} }
func renderReadPane(w io.Writer, title, account, folder, targetAccount string, index int, subject, from, date, body string) { func renderReadPane(w io.Writer, title, account, folder, targetAccount string, index int, subject, from, date, body string) {
if subject == "" { renderMailboxReadPane(w, title, account, folder, index, subject, from, date, body)
subject = "(ohne Betreff)"
}
fmt.Fprint(w, renderSourcePaneHead(account, folder, targetAccount, index))
fmt.Fprintf(w, `<div class="read-body"><div class="read-head"><h1 class="read-subject">%s</h1><div class="read-meta">Von: %s<br>Datum: %s</div></div><pre class="read-pre">%s</pre></div>`,
html.EscapeString(subject), html.EscapeString(from), html.EscapeString(date), html.EscapeString(body))
} }
func renderTargetPane(account, folder, targetAccount string, index int, raw []byte, note string) string { func renderTargetPane(account, folder, targetAccount string, index int, raw []byte, note string) string {
@ -359,14 +354,14 @@ func renderTargetMatch(b *strings.Builder, match forwardedMatch) {
} }
func renderInitialTargetPane() string { func renderInitialTargetPane() string {
return renderInitialSourceSelectPane(`<div class="ef-empty">Nachricht waehlen.</div>`) return renderInitialReadPane(`<div class="ef-empty">Nachricht waehlen.</div>`)
} }
func renderInitialReadPane(body string) string { func renderInitialReadPane(body string) string {
if strings.TrimSpace(body) == "" { if strings.TrimSpace(body) == "" {
body = `<div class="ef-empty">Nachricht waehlen.</div>` body = `<div class="ef-empty">Nachricht waehlen.</div>`
} }
return renderInitialSourceSelectPane(body) return `<div class="pane-head mode-head"><span class="mode-label">Vorschau</span></div><div class="read-body">` + body + `</div>`
} }
func renderInitialSourceSelectPane(body string) string { func renderInitialSourceSelectPane(body string) string {