|
@@ -0,0 +1,70 @@
|
|
|
+{{ define "patch_blogpost_editor" }}
|
|
|
+<form hx-patch="/admin/posts" hx-ext="json-enc" hx-target="#response" hx-swap="innerHTML">
|
|
|
+{{ end }}
|
|
|
+
|
|
|
+{{ define "post_blogpost_editor" }}
|
|
|
+<form hx-post="/admin/posts" hx-ext="json-enc" hx-target="#response" hx-swap="innerHTML">
|
|
|
+{{ end }}
|
|
|
+
|
|
|
+
|
|
|
+{{ define "blogpost_editor" }}
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+ <div class="container-fluid p-2 position-relative"
|
|
|
+ style="width: 80vw; max-width: 80%; background-color: rgb(22, 22, 22);">
|
|
|
+ <div class="container">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-sm"></div>
|
|
|
+ <div class="container position-relative">
|
|
|
+ <a style="color: white; height: fit-content; font-size: xx-large; font-weight: bold; font-family: monospace;">Making a New Post</a>
|
|
|
+ <div class="col m-5">
|
|
|
+ {{ if $.Post }}
|
|
|
+ {{ template "post_blogpost_editor" }}
|
|
|
+ {{ else }}
|
|
|
+ {{ template "patch_blogpost_editor" }}
|
|
|
+ {{ end }}
|
|
|
+ <div class="row"
|
|
|
+ style="background-color: rgb(22, 22, 22); color: white; height: fit-content; font-size: larger; font-family: monospace;">
|
|
|
+ <a>Title:</a>
|
|
|
+ <textarea name="title"
|
|
|
+ style="background-color: rgb(73, 73, 73); color: white;">{{ .Title }}</textarea>
|
|
|
+ </div>
|
|
|
+ <div class="row"
|
|
|
+ style="background-color: rgb(22, 22, 22); color: white; height: fit-content; font-size: larger; font-family: monospace;">
|
|
|
+ <a>Post ID:</a>
|
|
|
+ <textarea name="id"
|
|
|
+ style="background-color: rgb(73, 73, 73); color: white;">{{ .Ident }}</textarea>
|
|
|
+ </div>
|
|
|
+ <div class="row"
|
|
|
+ style="background-color: rgb(22, 22, 22); color: white; height: fit-content; font-size: larger; font-family: monospace;">
|
|
|
+ <a>Category:</a>
|
|
|
+ <select name="category" class="form-select"
|
|
|
+ style="background-color: rgb(73, 73, 73); color: white; height: fit-content; font-size: larger; font-family: monospace;">
|
|
|
+ <option selected>{{ .DefaultTopic }}</option>
|
|
|
+ {{ range .Topics }}
|
|
|
+ <option value="{{ . }}">{{ . }}</option>
|
|
|
+ {{ end }}
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="row"
|
|
|
+ style="background-color: rgb(22, 22, 22); color: white; height: fit-content; font-size: large; font-family: monospace;">
|
|
|
+ <a>Time of creation:</a>
|
|
|
+ <textarea name="created"
|
|
|
+ style="background-color: rgb(73, 73, 73); color: white;">{{ .Created }}</textarea>
|
|
|
+ </div>
|
|
|
+ <div class="row"
|
|
|
+ style="background-color: rgb(22, 22, 22); color: white; height: fit-content; font-size: larger; font-family: monospace;">
|
|
|
+ <a>Post Body:</a>
|
|
|
+ <textarea name="body" rows="30" wrap="soft"
|
|
|
+ style="background-color: rgb(73, 73, 73); color: white;">{{ .Body }}</textarea>
|
|
|
+ </div>
|
|
|
+ <button type="submit">Send</button><div id="response"></div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-sm"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</html>
|
|
|
+{{ end }}
|