message view: add part switcher
This also makes the appearance of HTML emails more consistent with plaintext ones.
This commit is contained in:
parent
e39879ec9a
commit
02bc8f68c9
2 changed files with 97 additions and 36 deletions
|
@ -152,11 +152,41 @@ main table td a { text-decoration: none; }
|
||||||
|
|
||||||
main table td a:hover { text-decoration: underline; }
|
main table td a:hover { text-decoration: underline; }
|
||||||
|
|
||||||
main.message pre { flex: 1 auto; padding: 1rem; white-space: pre-wrap; word-break: break-all; background-color: white; border: 1px solid #eee; max-width: 100% }
|
|
||||||
main.message table { background-color: white; }
|
main.message table { background-color: white; }
|
||||||
main.message th { width: 5%;}
|
main.message th { width: 5%;}
|
||||||
main.message h1 { font-size: 1.2rem; padding: 0.5rem;}
|
main.message h1 { font-size: 1.2rem; padding: 0.5rem;}
|
||||||
|
|
||||||
|
main.message pre,
|
||||||
|
main.message iframe {
|
||||||
|
flex: 1 auto;
|
||||||
|
padding: 1rem;
|
||||||
|
margin: 1rem 0;
|
||||||
|
background-color: white;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
main.message pre {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
main.message .message-header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
main.message .message-header .parts {
|
||||||
|
margin-left: 0.3rem;
|
||||||
|
padding: 0.3rem 1rem;
|
||||||
|
background: white;
|
||||||
|
border-top: 1px solid #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
main.message .message-header .parts ul {
|
||||||
|
margin-left: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
main.compose .actions {
|
main.compose .actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
|
@ -1,6 +1,32 @@
|
||||||
{{template "head.html" .}}
|
{{template "head.html" .}}
|
||||||
{{template "nav.html" .}}
|
{{template "nav.html" .}}
|
||||||
|
|
||||||
|
{{define "message-part-tree"}}
|
||||||
|
{{/* nested templates can't access the parent's context */}}
|
||||||
|
{{$ = index . 0}}
|
||||||
|
{{with index . 1}}
|
||||||
|
<a
|
||||||
|
class="nav-link"
|
||||||
|
{{if .IsText}}
|
||||||
|
href="{{$.Message.URL}}?part={{.PathString}}"
|
||||||
|
{{else}}
|
||||||
|
href="{{$.Message.URL}}/raw?part={{.PathString}}"
|
||||||
|
{{end}}
|
||||||
|
>
|
||||||
|
{{if eq $.Part.PathString .PathString}}<strong>{{end}}
|
||||||
|
{{.String}}
|
||||||
|
{{if eq $.Part.PathString .PathString}}</strong>{{end}}
|
||||||
|
</a>
|
||||||
|
{{if gt (len .Children) 0}}
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
{{range .Children}}
|
||||||
|
<li class="nav-item">{{template "message-part-tree" (tuple $ .)}}</li>
|
||||||
|
{{end}}
|
||||||
|
</ul>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
<div class="page-wrap">
|
<div class="page-wrap">
|
||||||
{{$current := .Mailbox}}
|
{{$current := .Mailbox}}
|
||||||
<aside>
|
<aside>
|
||||||
|
@ -107,6 +133,7 @@
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<div class="message-header">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">
|
<th colspan="2">
|
||||||
|
@ -142,6 +169,10 @@
|
||||||
</tr>
|
</tr>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</table>
|
</table>
|
||||||
|
<section class="parts">
|
||||||
|
{{template "message-part-tree" (tuple $ .Message.PartTree)}}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{define "addr-list"}}
|
{{define "addr-list"}}
|
||||||
{{range $i, $addr := .}}
|
{{range $i, $addr := .}}
|
||||||
|
|
Loading…
Reference in a new issue