digital_art_admin.html 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. {{ define "digital_art_admin_list" }}
  2. <div class="container-fluid p-3" style="color: white; font-family: monospace;">
  3. <h1>Modify Digital Art</h1>
  4. {{ range .Images }}
  5. <div class="row p-3 m-2 rounded" style="background-color: rgb(22, 22, 22);">
  6. <div class="col-sm-3">
  7. {{ if eq .MediaType "video/webm" }}
  8. <video src="/api/v1/images/{{ .Ident }}" controls muted preload="metadata" aria-label="{{ .Title }}" class="img-fluid"></video>
  9. {{ else }}
  10. <img src="/api/v1/images/{{ .Ident }}" alt="{{ .Title }}" loading="lazy" class="img-fluid">
  11. {{ end }}
  12. </div>
  13. <div class="col-sm">
  14. <h2>{{ .Title }}</h2>
  15. <p style="white-space: pre-wrap;">{{ .Desc }}</p>
  16. <a href="/admin/digital/{{ .Ident }}" hx-get="/admin/digital/{{ .Ident }}" hx-target="#main">Edit</a>
  17. </div>
  18. </div>
  19. {{ else }}
  20. <p>No digital art found.</p>
  21. {{ end }}
  22. </div>
  23. {{ end }}
  24. {{ define "digital_art_admin_editor" }}
  25. <div class="container p-3 rounded" style="max-width: 80vw; background-color: rgb(22, 22, 22); color: white; font-family: monospace;">
  26. <h1>Edit Digital Art</h1>
  27. <a href="/admin/digital" hx-get="/admin/digital" hx-target="#main">Back to digital art</a>
  28. <div class="my-3">
  29. {{ if eq .MediaType "video/webm" }}
  30. <video src="/api/v1/images/{{ .Ident }}" controls muted preload="metadata" aria-label="{{ .Title }}" class="img-fluid" style="max-height: 50vh;"></video>
  31. {{ else }}
  32. <img src="/api/v1/images/{{ .Ident }}" alt="{{ .Title }}" class="img-fluid" style="max-height: 50vh;">
  33. {{ end }}
  34. </div>
  35. <form action="/admin/digital/{{ .Ident }}" method="post" hx-post="/admin/digital/{{ .Ident }}" hx-target="#digital-art-response" hx-swap="innerHTML" hx-on::before-swap="if (event.detail.xhr.status >= 400) event.detail.shouldSwap = true">
  36. <div class="mb-3">
  37. <label for="digital-art-title" class="form-label">Title</label>
  38. <textarea id="digital-art-title" name="title" class="form-control" required>{{ .Title }}</textarea>
  39. </div>
  40. <div class="mb-3">
  41. <label for="digital-art-description" class="form-label">Description</label>
  42. <textarea id="digital-art-description" name="description" class="form-control" rows="5">{{ .Desc }}</textarea>
  43. </div>
  44. <button type="submit">Save changes</button>
  45. <div id="digital-art-response" role="status" aria-live="polite"></div>
  46. </form>
  47. <div class="mt-4">
  48. <button type="button" hx-delete="/admin/digital/{{ .Ident }}" hx-target="#main" hx-swap="innerHTML" hx-confirm="Remove this listing from the digital art page? The media file and links in posts will remain available." hx-on::before-swap="if (event.detail.xhr.status >= 400) event.detail.shouldSwap = true">Remove listing</button>
  49. <p>Removes it from the gallery; the media remains available to posts.</p>
  50. </div>
  51. </div>
  52. {{ end }}