apps/blobs/templates/detail.html 2.4 K raw
1
{{define "detail.html"}}{{template "base.html" .}}{{end}}
2
{{define "title"}}{{.Name}}{{end}}
3
{{define "content"}}
4
  <nav class="crumbs">
5
    <a href="/buckets">buckets</a>
6
    {{range .Crumbs}}<span class="crumb-sep">/</span><a href="{{.Href}}">{{.Label}}</a>{{end}}
7
    <span class="crumb-sep">/</span>
8
    <span>{{.Name}}</span>
9
  </nav>
10
11
  {{if .Error}}<p class="error">{{.Error}}</p>{{end}}
12
13
  <h2>{{.Name}}</h2>
14
15
  {{if .IsImage}}
16
    <div class="detail-preview">
17
      <img src="{{.PreviewSrc}}" alt="{{.Name}}">
18
    </div>
19
  {{end}}
20
21
  <dl class="detail-meta">
22
    <dt>key</dt><dd><code>{{.Key}}</code></dd>
23
    <dt>type</dt><dd>{{.ContentType}}</dd>
24
    <dt>size</dt><dd>{{.SizeHuman}} ({{.Size}} bytes)</dd>
25
    <dt>modified</dt><dd>{{.LastModified}}</dd>
26
    <dt>etag</dt><dd><code>{{.ETag}}</code></dd>
27
  </dl>
28
29
  <section class="detail-links">
30
    <h3>links</h3>
31
    {{if .PresignedURL}}
32
      <div class="link-row">
33
        <a href="{{.PresignedURL}}" target="_blank" rel="noopener">presigned download</a>
34
        <button type="button" class="link-button"
35
          onclick="navigator.clipboard.writeText('{{.PresignedURL}}');this.textContent='copied!'">
36
          copy
37
        </button>
38
      </div>
39
    {{end}}
40
    {{if .HasPublic}}
41
      <div class="link-row">
42
        <a href="{{.PublicURL}}" target="_blank" rel="noopener">public url</a>
43
        <button type="button" class="link-button"
44
          onclick="navigator.clipboard.writeText('{{.PublicURL}}');this.textContent='copied!'">
45
          copy
46
        </button>
47
      </div>
48
    {{else}}
49
      <p class="empty">no public url configured for this bucket (set BLOBS_PUBLIC_URLS)</p>
50
    {{end}}
51
  </section>
52
53
  <section class="detail-actions">
54
    <h3>actions</h3>
55
    <form method="POST" action="/b/{{.Bucket}}/replace" enctype="multipart/form-data" class="form">
56
      <input type="hidden" name="key" value="{{.Key}}">
57
      <label for="file">replace file (keeps same key)</label>
58
      <input type="file" id="file" name="file" required>
59
      <button type="submit">replace</button>
60
    </form>
61
62
    <form method="POST" action="/b/{{.Bucket}}/delete" class="form"
63
          onsubmit="return confirm('Delete {{.Name}}?');">
64
      <input type="hidden" name="key" value="{{.Key}}">
65
      <input type="hidden" name="returnTo" value="{{.ParentHref}}">
66
      <button type="submit" class="danger">delete</button>
67
    </form>
68
  </section>
69
{{end}}