Skip to content

Commit

Permalink
feat: show envelope's attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsNotGoodName committed Jul 20, 2023
1 parent 591464a commit 5d59559
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 31 deletions.
4 changes: 3 additions & 1 deletion web/views/attachments.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ <h2>
</form>
</details>

{{template "p/attachments-table" .Attachments}}
{{range $val := .Attachments}}
{{template "p/attachment" $val}}
{{end}}
</section>
</main>

Expand Down
4 changes: 3 additions & 1 deletion web/views/envelopes-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ <h2><a href="#message">Message</a></h2>
{{if .Envelope.Attachments}}
<section id="attachments">
<h2><a href="#attachments">Attachments</a></h2>
{{template "p/attachments-table" .Envelope.Attachments}}
{{range $val := .Envelope.Attachments}}
{{template "p/attachment" $val}}
{{end}}
</section>
{{end}}

Expand Down
6 changes: 3 additions & 3 deletions web/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ <h2>Retention Policy</h2>
<tbody>
{{if .RetentionPolicy.EnvelopeCount}}
<tr>
<th scope="row"><strong>Envelope Count Limit</strong></th>
<th scope="row"><strong>Max Envelope Count</strong></th>
<td>{{.RetentionPolicy.EnvelopeCount}}</td>
</tr>
{{end}}
{{if .RetentionPolicy.EnvelopeAge}}
<tr>
<th scope="row"><strong>Envelope Age Limit</strong></th>
<th scope="row"><strong>Max Envelope Age</strong></th>
<td>{{.RetentionPolicy.EnvelopeAge}}</td>
</tr>
{{end}}
{{if .RetentionPolicy.AttachmentSize}}
<tr>
<th scope="row"><strong>Attachment Size Limit</strong></th>
<th scope="row"><strong>Max Attachments Size</strong></th>
<td>{{bytesHumanize .RetentionPolicy.AttachmentSize}}</td>
</tr>
{{end}}
Expand Down
27 changes: 27 additions & 0 deletions web/views/p/attachment.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<article>
{{if .IsImage}}
<a href="/files/{{.FileName}}">
<img src="/files/{{.FileName}}" alt="{{.FileName}}">
</a>
{{else}}
<h2>
<a href="/files/{{.FileName}}">
{{.Name}}
</a>
</h2>
{{end}}
<nav>
<ul>
{{if .IsImage}}
<li>
{{.Name}}
</li>
{{end}}
</ul>
<ul>
<li>
<a href="/envelopes/{{.MessageID}}">Envelope</a>
</li>
</ul>
</nav>
</article>
26 changes: 0 additions & 26 deletions web/views/p/attachments-table.html

This file was deleted.

0 comments on commit 5d59559

Please sign in to comment.