From bb29f780e997836ee70d8f87d89f8d95326d5eff Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Wed, 10 May 2023 03:20:37 +0400 Subject: [PATCH] Added mindflow_admin.pug template and CSS. --- web/assets/css/mindflow_admin.css | 44 +++++++++++++++++++++++++++++ web/templates/mindflow_admin.pug | 47 +++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 web/assets/css/mindflow_admin.css create mode 100755 web/templates/mindflow_admin.pug diff --git a/web/assets/css/mindflow_admin.css b/web/assets/css/mindflow_admin.css new file mode 100644 index 0000000..6714148 --- /dev/null +++ b/web/assets/css/mindflow_admin.css @@ -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; } \ No newline at end of file diff --git a/web/templates/mindflow_admin.pug b/web/templates/mindflow_admin.pug new file mode 100755 index 0000000..b47fe7d --- /dev/null +++ b/web/templates/mindflow_admin.pug @@ -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.