| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- {{ 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" id="myTextarea"
- style="background-color: rgb(73, 73, 73); color: white;">{{ .Body }}</textarea>
- </div>
- <div class="row"
- style="background-color: rgb(22, 22, 22); color: white; height: fit-content; font-size: larger; font-family: monospace;">
-
- <a>Insert an image:</a>
- <select id="imageSelect" class="form-select"
- style="background-color: rgb(73, 73, 73); color: white; height: fit-content; font-size: larger; font-family: monospace;">
- <option selected value="">select an image to insert</option>
- {{ range .ImageIds }}
- <option value="{{ . }}">{{ . }}</option>
- {{ end }}
- </select>
- <button
- type="button"
- hx-on:click="insertSelectedImage()">
- Insert Image
- </button>
- </div>
- <div class="row"
- style="background-color: rgb(22, 22, 22); color: white; height: fit-content; font-size: larger; font-family: monospace;">
- <button type="submit">Send</button><div id="response"></div>
- </div>
- </form>
- </div>
- </div>
- <div class="col-sm"></div>
- </div>
- </div>
- </div>
- </html>
- {{ end }}
|