1
0

Added mindflow_admin.pug template and CSS.

This commit is contained in:
Alexander Andreev 2023-05-10 03:20:37 +04:00
parent fced4f31ad
commit bb29f780e9
Signed by: Arav
GPG Key ID: D22A817D95815393
2 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,44 @@
::placeholder { color: var(--primary-color); }
input[type=text],
select,
textarea {
background-color: var(--background-color);
border: none;
border-bottom: 1px solid var(--primary-color);
color: var(--text-color);
font: inherit; }
form#add {
display: grid;
gap: .5rem;
grid-template-areas:
"c n"
"t t"
"b b"
"a a";
grid-template-columns: 1fr 1fr;
max-width: 100%;
min-width: 100%;
width: 100%; }
form#add select { grid-area: c; }
form#add input[name="new-category"] { grid-area: n; }
form#add input[name="title"] { grid-area: t; }
form#add textarea[name="body"] { grid-area: b; }
form#add button[type="submit"] { grid-area: a; }
form.edit {
display: grid;
gap: .5rem;
grid-template-areas:
"b b"
"e d";
grid-template-columns: 1fr 1fr;
max-width: 100%;
min-width: 100%;
width: 100%; }
form.edit textarea { grid-area: b; }
form.edit input[name="edit"] { grid-area: e; }
form.edit input[name="delete"] { grid-area: d; }

View File

@ -0,0 +1,47 @@
extends base.pug
block meta_description
meta(name='description' content='Here I will post updates on my infrastructure, my very important opinions and thoughts.')
block append head
link(href='/assets/css/mindflow.css' rel='stylesheet')
link(href='/assets/css/mindflow_admin.css' rel='stylesheet')
script(src='/assets/js/mindflow_admin.js' defer='')
block nav
a(href='/') Home
a(href='/stuff') Stuff
a(href='/mindflow') Mindflow
a(href='/about') About
a(href='/guestbook') Guestbook
h1 Mindflow Admin
block content
:go:func MindflowAdmin(title string, posts []mindflow.Post, r *http.Request)
section
form(id='add' action='/api/mindflow', method='POST')
select(name='category' required='')
option(value='1' selected='') Update
option(value='2') Diary
option(value='0') New category
input(type='text', placeholder='New category name' name='new-category')
input(type='text', placeholder='Title' name='title' required='')
textarea(placeholder='Body post' name='body' required='')
button(type="submit") Add
section
if (len(posts) > 0)
each post in posts
article(id=post.PostID())
header
a(href=`#${post.PostID()}`)
h3= post.Category.Name + ": " + post.Title
form.edit
input(type='hidden', name='post_id' value=post.ID)
textarea(placeholder='Body post' name='body' required='')= post.Body
button(name='edit') Edit
button(name='delete') Delete
footer
time(datetime=util.ToClientTimezone(post.Date, r))= util.ToClientTimezone(post.Date, r).Format(time.RFC1123)
else
p.center Nothing? There must be some... Looks like database went down.