diff options
Diffstat (limited to 'src/templates/admin/blog_edit.html')
| -rw-r--r-- | src/templates/admin/blog_edit.html | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/templates/admin/blog_edit.html b/src/templates/admin/blog_edit.html new file mode 100644 index 0000000..99c3d9c --- /dev/null +++ b/src/templates/admin/blog_edit.html @@ -0,0 +1,42 @@ +{% extends "base.html" %} + +{% block head %} +{{ super() }} + +<link rel="stylesheet" href="/static/stylesheets/admin_blog.css"> +{% endblock %} + +{% block content %} + +<h1>edit a post!</h1> + +<button id="delete-post">delete</button> + +<form class="flex-col" method="post"> + <div class="flex-col" style="margin-bottom: 12px;"> + <label for="title">title:</label> + <input type="text" name="title" value="{{ post.title }}" /> + + <label for="description">description:</label> + <input type="text" name="description" value="{{ post.description or '' }}" /> + </div> + + <textarea placeholder="edit here" name="text">{{ post.original }}</textarea> + + <div class="flex-row" style="margin: 12px 0; gap: 6px;"> + <input type="checkbox" name="public" {{ "checked" if post.public else "" }} /> + <label for="public">make public</label> + </div> + + <input type="submit" value="edit" /> +</form> + +<script> +document.getElementById("delete-post").onclick = async (e) => { + origin = window.location.origin + await fetch(`${origin}/admin/blog/{{ post.id }}`, { method: "DELETE" }); + window.location.href = `${origin}/admin/blog`; +}; +</script> + +{% endblock %} |
