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

67 lines
3.0 KiB
Plaintext
Raw Normal View History

2023-02-05 04:43:34 +04:00
extends base.pug
mixin entryLine(line)
2023-05-23 03:28:04 +04:00
if (len(line) > 0 && 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='')
2023-06-03 23:31:07 +04:00
link(rel='canonical' href='/guestbook')
2023-02-05 04:43:34 +04:00
block nav
a(href='/') Home
a(href='/stuff') Stuff
a(href='/mindflow') Mindflow
a(href='/about') About
h1 Guestbook
block content
:go:import "git.arav.su/Arav/justguestbook"
:go:func Guestbook(title, owner, captcha_id string, pages_count int64, entries []*justguestbook.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
- var created_tz = util.ToClientTimezone(entry.Created, r).Format("Monday _2 January 2006 15:04:05 -07:00")
2023-05-23 03:28:21 +04:00
- var website = ""
if (!entry.HideWebsite)
- website = entry.Website
| ##{entry.ID} by #[span.highlighted #{entry.Name}] #[em #{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
- var reply_created_tz = util.ToClientTimezone(entry.Reply.Created, r).Format("Monday _2 January 2006 15:04:05 -07:00")
2023-02-05 21:12:00 +04:00
| 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