Files
Website/views/admin/gallery/gallery-edit.ejs
T
2026-11-24 22:05:11 +01:00

88 lines
2.8 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../../partials/head'); -%>
<%- include('../../partials/admin-editor-css'); -%>
<title>Admin - Edit Image</title>
</head>
<body>
<%- include('../../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<% if (image) { %>
<section>
<h1>Edit image</h1>
<form action="<%= endpoint %>/gallery/edit" method="post" class="editor-form editor-form--stacked">
<% if (image.isVideo) { %>
<video class="editor-preview-img" src="/gallery/thumbnail/<%= image.thumbnailName %>" alt="<%= image.name %>" muted playsinline loop></video>
<% } else { %>
<img class="editor-preview-img" src="/gallery/thumbnail/<%= image.thumbnailName %>" alt="<%= image.name %>">
<% } %>
<div class="editor-actions">
<a class="btn" href="/gallery/thumbnail/<%= image.thumbnailName %>">Thumbnail</a>
<% if (image.isVideo) { %>
<a class="btn" href="/gallery/video/<%= image.id %>">Video</a>
<% } else { %>
<a class="btn" href="/gallery/image/<%= image.imageName %>">Image</a>
<% } %>
</div>
<input type="text" name="id" required value="<%= image.id %>" hidden>
<label>
Name
<input type="text" name="name" required value="<%= image.name %>">
</label>
<label>
Description
<textarea name="description" rows="3"><%= image.description %></textarea>
</label>
<label>
Artists (comma-separated)
<input type="text" name="artists" class="multi-input" value="<%= image.artists.join(', ') %>">
</label>
<label>
Sources (comma-separated)
<input type="text" name="sources" class="multi-input" value="<%= image.sources.join(', ') %>">
</label>
<label>
Tags (comma-separated)
<input type="text" name="tags" class="multi-input" value="<%= image.tags.join(', ') %>">
</label>
<label>
Access Codes (comma-separated)
<input type="text" name="accessCodes" class="multi-input" value="<%= image.accessCodes.join(', ') %>">
</label>
<label>
Created Image
<input type="date" name="created" value="<%= image.createdAt.toISOString().split("T")[0] %>">
</label>
<button type="submit">Edit</button>
</form>
<form action="<%= endpoint %>/gallery/delete" method="post" class="editor-form editor-form--stacked">
<input type="text" name="id" required value="<%= image.id %>" hidden>
<button type="submit" class="delete">Delete</button>
</form>
</section>
<% } else { %>
<section><div>No image found</div></section>
<% } %>
</div>
<%- include('../../footer'); -%>
</body>
</html>