1
0

Changed guestbook.pug.

This commit is contained in:
Alexander Andreev 2023-02-05 21:12:00 +04:00
parent aa44e678b5
commit bedd336385
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -1,7 +1,7 @@
extends base.pug extends base.pug
mixin entryLine(line) mixin entryLine(line)
if (line[0] == ">") if (line[0] == '>')
p.quote= line p.quote= line
else else
p= line p= line
@ -21,41 +21,41 @@ block nav
h1 Guestbook h1 Guestbook
block content block content
:go:func About(title, captcha_id string, posts []guestbook.Posts) :go:func Guestbook(title, owner, captcha_id string, pages_count int64, entries []*guestbook.Entry, r *http.Request)
form#new-post(action='/guestbook', method='POST') form#new-post(action='/guestbook', method='POST')
input(type='text' maxlength='80' placeholder='Name (Anonymous if left blank)' name='name') input(type='text' maxlength='80' placeholder='Name (Anonymous if left blank)' name='name')
input(type='text' maxlength='255' placeholder='Website (optional)' name='website') input(type='text' maxlength='255' placeholder='Website (optional)' name='website')
textarea(maxlength='4096' placeholder='Your message' name='message' required) textarea(maxlength='4096' placeholder='Your message' name="message" required='')
span.checkboxes span.checkboxes
input(type='checkbox' id='hide-website' name='hide_website' checked) input(type='checkbox' id='hide-website' name='hide_website' checked='')
label(for='hide-website') Hide website #[small (only I can see if set)] label(for='hide-website') Hide website #[small (only I can see if set)]
span.captcha span.captcha
input(type='hidden' value=captcha_id name='captcha_id') input(type='hidden' value=captcha_id name='captcha_id')
img(src='/api/captcha/'+captcha_id+'/image', alt="CAPTCHA" width='160' height='40') img(src='/api/captcha/'+captcha_id+'/image', alt="CAPTCHA" width='160' height='40')
input(type='text' maxlength='6' placeholder='CAPTCHA' name='captcha_answer' required) input(type='text' maxlength='6' placeholder='CAPTCHA' name='captcha_answer' required='')
small Valid for #[b 10] minutes. small Valid for #[b 10] minutes.
input(type='submit' value='Send a post') input(type='submit' value='Send a post')
section#posts section#posts
if (posts) if (len(entries) > 0)
each post in posts each entry in entries
article article
header header
| Post ##{post.ID} by #[span.highlighted= post.Name] #{post.Website} on #[time(datetime=post.Created)= date_(post.Created, tz)] - var created_tz = util.ToClientTimezone(entry.Created, r).Format("2006-01-02T15:04:05")
each line in post.message.split("\n") | Entry ##{entry.ID} by #[span.highlighted #{entry.Name}] #{entry.Website} on #[time(datetime=created_tz) #{created_tz}]
each line in strings.Split(entry.Message, "\n")
+entryLine(line) +entryLine(line)
if post.feedback if (entry.Reply != nil)
.reply .reply
header header
| Reply by #[span.highlighted #{owner}] on #[time(datetime=post.feedback_created)= date_(post.feedback_created, tz)] - var reply_created_tz = util.ToClientTimezone(entry.Reply.Created, r).Format("2006-01-02 15:04:05")
each line in post.feedback.split("\n") | 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) +entryLine(line)
else else
if (posts === null) p.center No posts.
p.center Cannot establish database connection.
else
p.center No posts.
if pages_count > 1 if pages_count > 1
section#pagination section#pagination
- let n = 1; - var n int64 = 1;
while n <= pages_count while n <= pages_count
a(href='/guestbook?p='+n)= n++ a(href='/guestbook?p='+string(n))= n
- n += 1