diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-03 13:07:25 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-12-03 13:07:25 +0100 |
commit | be14524c3384c88f0a5b0d64c4584abcc6ae0665 (patch) | |
tree | 157663357ab0c55b98d53e7feb8be0f7849f1ff1 /public | |
parent | 33b8679f1c6b2055196536b3e3ae808195202377 (diff) | |
download | alps-be14524c3384c88f0a5b0d64c4584abcc6ae0665.tar.gz alps-be14524c3384c88f0a5b0d64c4584abcc6ae0665.zip |
Display & download any message part
Diffstat (limited to 'public')
-rw-r--r-- | public/message.html | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/public/message.html b/public/message.html index 18646f0..09e56ac 100644 --- a/public/message.html +++ b/public/message.html @@ -6,21 +6,42 @@ <h2>{{.Message.Envelope.Subject}}</h2> -{{define "message-part"}} - <a href="?part={{.PathString}}">{{.MIMEType}}</a> - {{if gt (len .Children) 0}} - <ul> - {{range .Children}} - <li>{{template "message-part" .}}</li> +{{define "message-part-tree"}} + {{/* nested templates can't access the parent's context */}} + {{$ = index . 0}} + {{with index . 1}} + <a + {{if .IsText}} + href="{{$.Message.Uid}}?part={{.PathString}}" + {{else}} + href="{{$.Message.Uid}}/raw?part={{.PathString}}" + {{end}} + > + {{if eq $.PartPath .PathString}}<strong>{{end}} + {{.String}} + {{if eq $.PartPath .PathString}}</strong>{{end}} + </a> + {{if gt (len .Children) 0}} + <ul> + {{range .Children}} + <li>{{template "message-part-tree" (tuple $ .)}}</li> + {{end}} + </ul> {{end}} - </ul> {{end}} {{end}} -{{template "message-part" .Message.PartTree}} +<p>Parts:</p> + +{{template "message-part-tree" (tuple $ .Message.PartTree)}} + +<hr> {{if .Body}} <pre>{{.Body}}</pre> +{{else}} + <p>Can't preview this message part.</p> + <a href="{{.Message.Uid}}/raw?part={{.PartPath}}">Download</a> {{end}} {{template "foot"}} |