aboutsummaryrefslogtreecommitdiff
path: root/public/themes/sourcehut/message.html
blob: 07b4ad9b4afe338e6509d6cef2ad246ccba2a833 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{{template "head.html"}}
{{template "nav.html"}}

<div class="container-fluid">
  <div class="row">
    <div class="col-md-12 header-tabbed">
      <h2 style="margin-bottom: 1rem;" class="d-block">
        {{if .Message.Envelope.Subject}}
          {{.Message.Envelope.Subject}}
        {{else}}
          (No subject)
        {{end}}
      </h2>
      <div class="container message-tabs">
        <ul class="nav nav-tabs">
          <li class="nav-item">
            <a class="nav-link active" href="#">View message</a>
          </li>
          <li class="nav-item">
            <a
              class="nav-link"
              href="{{.Message.Uid}}/reply?part={{.PartPath}}"
            >Reply</a>
          </li>
          <li class="mr-auto d-none d-sm-flex"></li>
          <li class="nav-item">
            <a
              class="nav-link"
              href="/mailbox/{{.Mailbox.Name | pathescape}}?page={{.MailboxPage}}"
            >
              <span class="icon icon-caret-left">
                {{template "caret-left.html"}}
              </span>
              Back
            </a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</div>

{{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.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 class="nav flex-column">
			{{range .Children}}
				<li class="nav-item">{{template "message-part-tree" (tuple $ .)}}</li>
			{{end}}
		</ul>
		{{end}}
	{{end}}
{{end}}

<div class="container message-container">
  <div class="row">
    <div class="col-md-10 body-column">
      {{if .Body}}
        <pre>{{.Body}}</pre>
      {{else}}
        <p>Can't preview this message part.</p>
        <a href="{{.Message.Uid}}/raw?part={{.PartPath}}">Download</a>
      {{end}}
    </div>
    <div class="col-md-2 parts-column">
      {{template "message-part-tree" (tuple $ .Message.PartTree)}}
    </div>
  </div>
</div>

{{template "foot.html"}}