2023-05-10 03:20:37 +04:00
|
|
|
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
|
2023-05-22 21:32:09 +04:00
|
|
|
:go:func MindflowAdmin(title string, posts []mindflow.Post, categories []mindflow.Category, r *http.Request)
|
2023-05-10 03:20:37 +04:00
|
|
|
|
|
|
|
section
|
|
|
|
form(id='add' action='/api/mindflow', method='POST')
|
|
|
|
select(name='category' required='')
|
2023-05-22 21:32:09 +04:00
|
|
|
each category in categories
|
|
|
|
if (category.ID == 1)
|
|
|
|
option(value=category.ID selected='') #{category.Name}
|
|
|
|
else
|
|
|
|
option(value=category.ID) #{category.Name}
|
|
|
|
option(value='0') -- New category --
|
2023-05-10 03:20:37 +04:00
|
|
|
input(type='text', placeholder='New category name' name='new-category')
|
|
|
|
input(type='text', placeholder='Title' name='title' required='')
|
2023-05-22 21:32:09 +04:00
|
|
|
textarea(placeholder='Body post' name!='body' required='')
|
2023-05-10 03:20:37 +04:00
|
|
|
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
|
2023-05-22 05:22:47 +04:00
|
|
|
select(name='category')
|
|
|
|
option(value='' selected='') -- Change to category --
|
|
|
|
option(value='1') Update
|
|
|
|
option(value='2') Diary
|
|
|
|
option(value='0') New category
|
|
|
|
input(type='text', placeholder='New category name' name='new-category')
|
|
|
|
input(type='hidden', name='post-id' value=post.ID)
|
|
|
|
input(type='hidden', name='old-category' value=post.Category.ID)
|
|
|
|
input(type='text', placeholder='Title' name='title' value=post.Title required='')
|
2023-05-10 03:20:37 +04:00
|
|
|
textarea(placeholder='Body post' name='body' required='')= post.Body
|
2023-05-22 05:22:47 +04:00
|
|
|
button(name='edit-post') Edit
|
|
|
|
button(name='delete-post') Delete
|
2023-05-10 03:20:37 +04:00
|
|
|
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.
|