A webmail client. Forked from https://git.sr.ht/~migadu/alps
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

225 lines
8.2 KiB

  1. {{template "head.html" .}}
  2. {{template "nav.html" .}}
  3. {{template "util.html" .}}
  4. <div class="page-wrap">
  5. {{ $current := .Mailbox }}
  6. {{ template "aside" . }}
  7. <div class="container">
  8. <main class="message">
  9. <section class="actions">
  10. <div class="actions-wrap">
  11. <div class="actions-message">
  12. {{$back := printf "%v?page=%v" .Mailbox.URL .MailboxPage}}
  13. <a href="{{$back}}" class="button-link">« Back</a>
  14. {{ if and (ne .Mailbox.Name "Archive") (ne .Mailbox.Name "Drafts") (ne .Mailbox.Name "Sent") }}
  15. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  16. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  17. <input type="hidden" name="to" value="Archive">
  18. <input type="hidden" name="next" value="{{$back}}">
  19. <button>Archive</button>
  20. </form>
  21. {{ end }}
  22. {{ if and (ne .Mailbox.Name "INBOX") (ne .Mailbox.Name "Sent") (ne .Mailbox.Name "Drafts") }}
  23. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  24. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  25. <input type="hidden" name="to" value="INBOX">
  26. <button>
  27. {{ if (eq .Mailbox.Name "Junk") }}
  28. Not Spam
  29. {{ else }}
  30. Move to Inbox
  31. {{ end }}
  32. </button>
  33. </form>
  34. {{ end }}
  35. {{ if or (eq .Mailbox.Name "INBOX") (eq .Mailbox.Name "Trash") }}
  36. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  37. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  38. <input type="hidden" name="next" value="{{$back}}">
  39. <input type="hidden" name="to" value="Junk">
  40. <button>Report Spam</button>
  41. </form>
  42. {{ end }}
  43. {{ if or (eq .Mailbox.Name "Trash") (eq .Mailbox.Name "Junk") }}
  44. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/delete">
  45. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  46. <input type="hidden" name="next" value="{{$back}}">
  47. <button>Delete Permanently</button>
  48. </form>
  49. {{ else }}
  50. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  51. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  52. <input type="hidden" name="next" value="{{$back}}">
  53. <input type="hidden" name="to" value="Trash">
  54. <button>Delete</button>
  55. </form>
  56. {{ end }}
  57. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/flag">
  58. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  59. <input type="hidden" name="action" value="remove">
  60. <input type="hidden" name="flags" value="\Seen">
  61. <input type="hidden" name="next" value="{{$back}}">
  62. <button>Mark&nbsp;Unread</button>
  63. </form>
  64. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  65. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  66. <select class="action-group" name="to">
  67. {{range .Mailboxes}}
  68. <option value="{{.Name}}" {{if eq .Name $.Mailbox.Name}}selected>Move to...{{else}}>{{.Name}}{{ end }}</option>
  69. {{end}}
  70. </select>
  71. <button class="action-group" type="submit">Move</button>
  72. </form>
  73. <span class="followups action-group">
  74. {{if .Message.HasFlag "\\Draft"}}
  75. <a class="action-group button-link" href="{{.Message.URL}}/edit{{if .Message.TextPart}}?part={{.Message.TextPart.PathString}}{{end}}">Edit draft</a>
  76. {{else}}
  77. <a class="action-group button-link" href="{{.Message.URL}}/reply{{if .Message.TextPart}}?part={{.Message.TextPart.PathString}}{{end}}">Reply</a>
  78. <a class="action-group button-link" href="{{.Message.URL}}/forward{{if .Message.TextPart}}?part={{.Message.TextPart.PathString}}{{end}}">Forward</a>
  79. {{end}}
  80. </span>
  81. <span class="action-group">
  82. <a
  83. class="action-group button-link"
  84. id="print"
  85. href="#"
  86. style="display: none"
  87. >Print</a>
  88. </span>
  89. </div>
  90. </div>
  91. </section>
  92. <div class="message-header">
  93. <table>
  94. <tr>
  95. <th colspan="2">
  96. <h1>
  97. {{if .Message.Envelope.Subject}}
  98. {{.Message.Envelope.Subject}}
  99. {{else}}
  100. (No subject)
  101. {{end}}
  102. </h1>
  103. </th>
  104. </tr>
  105. <tr>
  106. <th>From:</th>
  107. <td>{{template "addr-list" .Message.Envelope.From}}</td>
  108. </tr>
  109. <tr>
  110. <th>Date:</th>
  111. <td>{{.Message.Envelope.Date | formatdate}}</td>
  112. </tr>
  113. <tr>
  114. <th>To:</th><td>{{template "addr-list" .Message.Envelope.To}}</td>
  115. </tr>
  116. {{if .Message.Envelope.Cc}}
  117. <tr>
  118. <th>Cc:</th><td>{{template "addr-list" .Message.Envelope.Cc}}</td>
  119. </tr>
  120. {{end}}
  121. {{if .Message.Envelope.Bcc}}
  122. <tr>
  123. <th>Bcc:</th>
  124. <td>{{template "addr-list" .Message.Envelope.Bcc}}</td>
  125. </tr>
  126. {{ end }}
  127. {{if and .Extra.HasRemoteResources (not .Extra.RemoteResourcesAllowed)}}
  128. <tr class="remote-content">
  129. <td colspan="2">
  130. This message contains remote content, such as external images.
  131. <a href="?part={{.Part.PathString}}&allow-remote-resources=1">
  132. Load remote content »
  133. </a>
  134. </td>
  135. </tr>
  136. {{end}}
  137. </table>
  138. {{ $attachments := .Message.Attachments }}
  139. {{ if $attachments }}
  140. <section class="parts">
  141. <h3>Attachments</h3>
  142. <ul>
  143. {{ range .Message.Attachments }}
  144. <li>
  145. <a
  146. class="nav-link"
  147. {{if .IsText}}
  148. href="?part={{.PathString}}"
  149. {{else}}
  150. href="{{$.Message.URL}}/raw?part={{.PathString}}"
  151. {{end}}
  152. >
  153. {{- if .Filename -}}
  154. {{.Filename}}
  155. {{- else -}}
  156. (no filename)
  157. {{- end -}}
  158. </a> ({{.MIMEType}}, {{.SizeString}})
  159. </li>
  160. {{ end }}
  161. </ul>
  162. </section>
  163. {{ end }}
  164. </div>
  165. {{define "addr-list"}}
  166. {{range $i, $addr := .}}
  167. {{if $i}},{{end}}
  168. <strong>{{.PersonalName}}</strong>
  169. &lt;<a href="/compose?to={{.Address}}">{{.Address}}</a>&gt;
  170. {{end}}
  171. {{end}}
  172. {{ $html := .Message.HTMLPart }}
  173. {{ $text := .Message.TextPart }}
  174. <div class="tabs">
  175. {{/* https://github.com/golang/go/issues/31103 */}}
  176. <a
  177. href="?part={{$text.PathString}}"
  178. {{ if eq $text.PathString .Part.PathString }}
  179. class="active"
  180. {{ end }}
  181. >
  182. {{ if eq $text.MIMEType "text/html" }}
  183. HTML
  184. {{ else }}
  185. Plain text
  186. {{ end }}
  187. </a>
  188. {{ if and $html $text }}
  189. {{ if ne $html.PathString $text.PathString }}
  190. <a
  191. href="?part={{$html.PathString}}"
  192. {{ if eq $html.PathString .Part.PathString }}
  193. class="active"
  194. {{ end }}
  195. >HTML</a>
  196. {{ end }}
  197. {{ end }}
  198. <a href="{{.Message.URL}}/raw?plain=1">Raw email</a>
  199. </div>
  200. {{if .View}}
  201. {{.View}}
  202. {{else}}
  203. <p>Can't preview this message part.</p>
  204. <a href="{{.Message.URL}}/raw?part={{.Part.PathString}}">Download</a>
  205. {{end}}
  206. </main>
  207. </div>
  208. </div>
  209. <script src="/themes/alps/assets/print.js"></script>
  210. {{template "foot.html"}}