Compare commits

...

2 Commits

Author SHA1 Message Date
b1ek 1ea2f3dfaa
add data editor 2023-03-02 23:25:51 +10:00
b1ek 6c8c23f8b3
change name 2023-03-02 23:25:44 +10:00
2 changed files with 51 additions and 1 deletions

50
view/admin/data_edit.pug Normal file
View File

@ -0,0 +1,50 @@
//-
This template accepts following parameters:
title - Page title
endpoint - Where the data should be returned
description - Description for user
pref_method - Method to return data with
data - Types and names of data
data is an JSON of objects with following structure:
id: {
name?: string,
type?: string(text|textarea|codearea|boolean|number|email),
def?: string
}
btn_name - Change the name of send button
extends ../layout/main.pug
block root
-
if (title == undefined)
var title = 'Data editor'
block content
h1= title
if (description)
p !{description}
hr
form(action=endpoint ? endpoint : '' method=pref_method ? pref_method : 'POST')
table
if (data)
each row, key in data
tr
td= row.name
td :
td
case row.type
when 'text'
input(type='text' name=key)
when 'textarea'
textarea(name=key)
when 'codearea'
textarea(name=key style='font-family:monospace')
when 'email'
input(type='email' name=key)
default
input(type='text' name=key)
input(type='submit' value=btn_name ? btn_name : 'Send!')

View File

@ -33,7 +33,7 @@ block content
| #{entry.text} | #{entry.text}
a(href='/guestbook') Write something in my guestbook! a(href='/guestbook') Write something in my guestbook!
td(width='50%' style='border-left:1px solid #c2c4c2;border-right:1px solid #c2c4c2;padding:0 1%') td(width='50%' style='border-left:1px solid #c2c4c2;border-right:1px solid #c2c4c2;padding:0 1%')
h3 Blog h3 Articles
ul ul
each article in articles each article in articles
li(style='font-size:16pt') li(style='font-size:16pt')