1
0
dwelling-home/web/templates/guestbook.pug

62 lines
2.7 KiB
Plaintext
Raw Normal View History

2023-02-05 04:43:34 +04:00
extends base.pug
mixin entryLine(line)
2023-02-05 21:12:00 +04:00
if (line[0] == '>')
2023-02-05 04:43:34 +04:00
p.quote= line
else
p= line
block meta_description
meta(name='description' content="This is my guestbook. Welcome.")
block append head
link(href='/assets/css/guestbook.css' rel='stylesheet')
script(src='/assets/js/captcha_refresh.js' defer='')
block nav
a(href='/') Home
a(href='/stuff') Stuff
a(href='/mindflow') Mindflow
a(href='/about') About
h1 Guestbook
block content
2023-02-05 21:12:00 +04:00
:go:func Guestbook(title, owner, captcha_id string, pages_count int64, entries []*guestbook.Entry, r *http.Request)
form#new-post(action='/api/guestbook', method='POST')
2023-02-05 04:43:34 +04:00
input(type='text' maxlength='80' placeholder='Name (Anonymous if left blank)' name='name')
input(type='text' maxlength='255' placeholder='Website (optional)' name='website')
2023-02-05 21:12:00 +04:00
textarea(maxlength='4096' placeholder='Your message' name="message" required='')
2023-02-05 04:43:34 +04:00
span.checkboxes
2023-02-05 21:12:00 +04:00
input(type='checkbox' id='hide-website' name='hide_website' checked='')
2023-02-05 04:43:34 +04:00
label(for='hide-website') Hide website #[small (only I can see if set)]
span.captcha
input(type='hidden' value=captcha_id name='captcha_id')
img(src='/api/captcha/'+captcha_id+'/image', alt="CAPTCHA" width='160' height='40')
2023-02-05 21:12:00 +04:00
input(type='text' maxlength='6' placeholder='CAPTCHA' name='captcha_answer' required='')
2023-02-05 04:43:34 +04:00
small Valid for #[b 10] minutes.
input(type='submit' value='Send a post')
section#posts
2023-02-05 21:12:00 +04:00
if (len(entries) > 0)
each entry in entries
2023-02-05 04:43:34 +04:00
article
header
2023-02-05 21:12:00 +04:00
- var created_tz = util.ToClientTimezone(entry.Created, r).Format("2006-01-02T15:04:05")
2023-02-05 21:49:16 +04:00
| Entry ##{entry.ID} by #[span.highlighted #{entry.Name}] #[em #{entry.Website}] on #[time(datetime=created_tz) #{created_tz}]
2023-02-05 21:12:00 +04:00
each line in strings.Split(entry.Message, "\n")
2023-02-05 04:43:34 +04:00
+entryLine(line)
2023-02-05 21:12:00 +04:00
if (entry.Reply != nil)
2023-02-05 04:43:34 +04:00
.reply
header
2023-02-05 21:12:00 +04:00
- var reply_created_tz = util.ToClientTimezone(entry.Reply.Created, r).Format("2006-01-02 15:04:05")
| Reply by #[span.highlighted #{owner}] on #[time(datetime=reply_created_tz) #{reply_created_tz}]
each line in strings.Split(entry.Reply.Message, "\n")
2023-02-05 04:43:34 +04:00
+entryLine(line)
else
2023-02-05 21:12:00 +04:00
p.center No posts.
2023-02-05 04:43:34 +04:00
if pages_count > 1
section#pagination
2023-02-05 21:12:00 +04:00
- var n int64 = 1;
2023-02-05 04:43:34 +04:00
while n <= pages_count
2023-02-05 21:21:43 +04:00
a(href='/guestbook?p='+fmt.Sprint(n))= n
2023-02-05 21:12:00 +04:00
- n += 1