Inital commit
This commit is contained in:
commit
a6af7dbfcb
114 files changed
+27520
No files matched your search
@@ -0,0 +1,104 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<%- include('../partials/head'); -%>
|
||||
<%- include('../partials/admin-editor-css'); -%>
|
||||
<title>Admin - Badge editor</title>
|
||||
</head>
|
||||
<body>
|
||||
<%- include('../winter'); -%>
|
||||
|
||||
|
||||
<div class="editor-container">
|
||||
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
|
||||
<section>
|
||||
<h2>Add badge</h2>
|
||||
<form action="<%= endpoint %>/badge/add" method="post" class="editor-form editor-form--compact">
|
||||
<input type="text" name="name" placeholder="Name" required>
|
||||
|
||||
<div class="icon-select">
|
||||
<input type="hidden" name="icon" value="">
|
||||
|
||||
<button type="button" class="icon-select-trigger">
|
||||
<span style="color:#bbb;">None</span>
|
||||
</button>
|
||||
|
||||
<div class="icon-options">
|
||||
<div class="icon-option" data-id="" data-name="">
|
||||
<span style="color:#bbb;">None</span>
|
||||
</div>
|
||||
<% icons.forEach(icon => { %>
|
||||
<div class="icon-option" data-id="<%= icon.id %>" data-name="<%= icon.path %>">
|
||||
<img src="/assets/images/<%= icon.path %>" alt="<%= icon.alt %>">
|
||||
<span><%= icon.alt %></span>
|
||||
</div>
|
||||
<% }) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit">Add</button>
|
||||
</form>
|
||||
</section>
|
||||
<% for (var i = 0; i < badges.length; i++) { %>
|
||||
<section>
|
||||
<form action="<%= endpoint %>/badge/edit" method="post" class="editor-form editor-form--compact">
|
||||
<input type="hidden" name="id" value="<%= i %>">
|
||||
|
||||
<input type="text" name="name" value="<%= badges[i].name %>" placeholder="Name" required>
|
||||
|
||||
<div class="icon-select">
|
||||
<input type="hidden" name="icon" value="<%= badges[i].iconId ?? '' %>">
|
||||
<button type="button" class="icon-select-trigger">
|
||||
<% if (badges[i].iconName) { %>
|
||||
<img src="/assets/images/<%= badges[i].iconName %>" alt="">
|
||||
<% } else { %>
|
||||
<span style="color:#bbb;">None</span>
|
||||
<% } %>
|
||||
</button>
|
||||
<div class="icon-options">
|
||||
<div class="icon-option" data-id="" data-name="">
|
||||
<span style="color:#bbb;">None</span>
|
||||
</div>
|
||||
<% icons.forEach(icon => { %>
|
||||
<div class="icon-option" data-id="<%= icon.id %>" data-name="<%= icon.path %>">
|
||||
<img src="/assets/images/<%= icon.path %>" alt="<%= icon.alt %>">
|
||||
<span><%= icon.alt %></span>
|
||||
</div>
|
||||
<% }) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
|
||||
<div style="display:flex; gap:0.5rem; margin-top:0.5rem;">
|
||||
<form action="<%= endpoint %>/badge/delete" method="post">
|
||||
<input type="hidden" name="id" value="<%= i %>">
|
||||
<button type="submit" style="border-color:var(--admin-danger);color:var(--admin-danger);">Delete</button>
|
||||
</form>
|
||||
<form action="<%= endpoint %>/badge/move/up" method="post">
|
||||
<input type="hidden" name="id" value="<%= i %>">
|
||||
<button type="submit" aria-label="Move up" title="Move up">↑</button>
|
||||
</form>
|
||||
<form action="<%= endpoint %>/badge/move/down" method="post">
|
||||
<input type="hidden" name="id" value="<%= i %>">
|
||||
<button type="submit" aria-label="Move down" title="Move down">↓</button>
|
||||
</form>
|
||||
</div>
|
||||
<% if (badges[i].icon) { %>
|
||||
<img class="preview" src="<%= badges[i].icon %>" alt="<%= badges[i].icon %>">
|
||||
<% } else { %>
|
||||
<span class="preview" style="color:#bbb;">No image</span> <% }
|
||||
%>
|
||||
</section>
|
||||
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<%- include('../partials/icon-select-script'); -%>
|
||||
</script>
|
||||
|
||||
<%- include('../footer'); -%>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user