Skip to content

Commit

Permalink
SMTP GUI: Adding size to Body / Multipart index
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Hinderberger committed Jul 4, 2024
1 parent 3588c58 commit 359c088
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/smtp/gui_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,20 @@ <h4>Message Metadata</h4>
</p>
<p>
<h4>Body / Multiparts:</h4>
{{ define "humanSize" -}}
{{- if lt . 1000 }}{{ . }} B
{{- else if lt . 1000000 }}{{ div . 1000 }} KB
{{- else }}{{ div . 1000000 }} MB{{ end -}}
{{- end }}

{{ define "contentLinks" }}
{{ $contentType := .metadata.contentType }}
{{ if not $contentType }}
{{ $contentType = "text/plain" }}
{{ end }}

<li>
{{ .metadata.idx }}: {{ $contentType }}<br>
{{ .metadata.idx }}: {{ $contentType }} ({{ template "humanSize" .metadata.bodySize }})<br>
<a href='javascript:previewContent("{{ .linkPrefix }}/body")'>Preview</a>
&bull;
<a href="{{ .linkPrefix }}/body" target="_blank">Download / Open in new Tab</a>
Expand Down

0 comments on commit 359c088

Please sign in to comment.