aboutsummaryrefslogtreecommitdiff
path: root/themes/alps/mailbox.html
blob: db029eb17bdf86e2b5cad56a8f336937936afdc5 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{{template "head.html" .}}
{{template "nav.html" .}}
{{template "util.html" .}}

{{ define "mbox-link" }}
{{ if not (.HasAttr "\\Noselect") }}
<a href="{{.URL}}" {{ if .Active }}class="active"{{ end }}>
  {{- if eq .Name "INBOX" -}}
    Inbox
  {{- else -}}
    {{ .Name }}
  {{- end -}}
  {{- if .HasAttr "\\HasChildren" }}/{{ end }}

  {{ if and (ne .Unseen -1) (ne .Unseen 0) }}({{ .Unseen }}){{ end }}
</a>
{{ else }}
<span class="noselect">
  {{.Name}}{{- if .HasAttr "\\HasChildren" }}/{{ end }}
</span>
{{ end }}
{{ end }}

<div class="page-wrap">
  {{ template "aside" . }}
  <div class="container">
    <form id="messages-form" method="post"></form>
    <main class="message-list">
      <section class="actions">
        {{ template "messages-header.html" . }}
      </section>
      <section class="messages">
        <div class="message-grid">
          {{range .Messages}}
          {{ $classes := "message-list-item" }}
          {{ if not (.HasFlag "\\Seen") }}
          {{ $classes = printf "%s %s" $classes "message-list-unread" }}
          {{ end }}
          {{ if (.HasFlag "\\Deleted") }}
          {{ $classes = printf "%s %s" $classes "message-list-deleted" }}
          {{ end }}

          {{ if not (.HasFlag "\\Deleted") }}
          <div class="message-list-checkbox {{$classes}}">
            <input type="checkbox" name="uids" value="{{.Uid}}" form="messages-form">
          </div>
          <div class="message-list-sender {{$classes}}">
            {{ range .Envelope.From }}
            <a href='?query=from:"{{.MailboxName}}@{{.HostName}}"'>
            {{ if .PersonalName }}
              {{.PersonalName}}
            {{ else }}
              {{.MailboxName}}@{{.HostName}}
            {{ end }}
            </a>
            {{ end }}
          </div>
          <div class="message-list-flags {{$classes}}">
            {{if .Attachments}}<span class="Has attachments">📎</span>{{end}}
            {{if .HasFlag "\\Answered"}}<span class="Replied"></span>{{end}}
            {{if .HasFlag "$Forwarded"}}<span class="Forwarded"></span>{{end}}
            <form method="POST" action="/message/{{.Mailbox}}/flag">
              <input type="hidden" name="uids" value="{{.Message.Uid}}">
              {{ if .HasFlag "\\Flagged" -}}
              <input type="hidden" name="action" value="remove">
              {{ else }}
              <input type="hidden" name="action" value="add">
              {{ end }}
              <input type="hidden" name="flags" value="\Flagged">
              <input type="hidden" name="next" value="{{$.GlobalData.URL.Path}}">
              <button class="flag-button button-link" type="submit">
                {{- if .HasFlag "\\Flagged" -}}{{- else -}}{{- end -}}
              </button>
            </form>
          </div>
          <div class="message-list-subject {{$classes}}">
            <a href="{{if .TextPart}}{{.TextPart.URL false}}{{else}}{{.URL}}{{end}}">
              {{if .Envelope.Subject}}
                {{.Envelope.Subject}}
              {{else}}
                (No subject)
              {{end}}
            </a>
          </div>
          <div class="message-list-date {{$classes}}">
            {{ .Envelope.Date | formatdate }}
          </div>
          {{ else }}
          <div class="message-list-checkbox {{$classes}}">
            <input type="checkbox" form="messages-form" disabled readonly>
          </div>
          <div class="message-list-sender {{$classes}}"></div>
          <div class="message-list-flags {{$classes}}"></div>
          <div class="message-list-subject {{$classes}}">
            <em>(this email was deleted by another client)</em>
          </div>
          <div class="message-list-date {{$classes}}"></div>
          {{ end }}

          {{ end }}
          {{if not .Messages}}
          <p class="empty-list">Nothing here yet.</p>
          {{end}}
        </div>
      </section>
      <section class="actions">
        {{ template "messages-header.html" . }}
      </section>
    </main>
  </div>
</div>
{{template "foot.html"}}