67 lines
3.0 KiB
Plaintext
Executable File
67 lines
3.0 KiB
Plaintext
Executable File
extends base.pug
|
|
|
|
mixin entryLine(line)
|
|
if (len(line) > 0 && line[0] == '>')
|
|
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='')
|
|
link(rel='canonical' href='/guestbook')
|
|
|
|
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')
|
|
input(type='text' maxlength='80' placeholder='Name (Anonymous if left blank)' name='name')
|
|
input(type='text' maxlength='255' placeholder='Website (optional)' name='website')
|
|
textarea(maxlength='4096' placeholder='Your message' name="message" required='')
|
|
span.checkboxes
|
|
input(type='checkbox' id='hide-website' name='hide_website' checked='')
|
|
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')
|
|
input(type='text' maxlength='6' placeholder='CAPTCHA' name='captcha_answer' required='')
|
|
small Valid for #[b 10] minutes.
|
|
input(type='submit' value='Send a post')
|
|
section#posts
|
|
if (len(entries) > 0)
|
|
each entry in entries
|
|
article
|
|
header
|
|
- var created_tz = util.ToClientTimezone(entry.Created, r).Format("Monday _2 January 2006 15:04:05 -07: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}]
|
|
each line in strings.Split(entry.Message, "\n")
|
|
+entryLine(line)
|
|
if (entry.Reply != nil)
|
|
.reply
|
|
header
|
|
- var reply_created_tz = util.ToClientTimezone(entry.Reply.Created, r).Format("Monday _2 January 2006 15:04:05 -07:00")
|
|
| Reply by #[span.highlighted #{owner}] on #[time(datetime=reply_created_tz) #{reply_created_tz}]
|
|
each line in strings.Split(entry.Reply.Message, "\n")
|
|
+entryLine(line)
|
|
else
|
|
p.center No posts.
|
|
if pages_count > 1
|
|
section#pagination
|
|
- var n int64 = 1;
|
|
while n <= pages_count
|
|
a(href='/guestbook?p='+fmt.Sprint(n))= n
|
|
- n += 1
|