post layout, postform and ban page improvements

merge-requests/208/head
fatchan 5 years ago
parent 88e86c5349
commit 0f3dbfa931
  1. 26
      gulp/res/css/style.css
  2. 2
      helpers/captcha/captchaverify.js
  3. 117
      views/includes/postform.pug
  4. 16
      views/mixins/post.pug
  5. 13
      views/pages/ban.pug

@ -500,6 +500,10 @@ textarea {
clear: both; clear: both;
} }
.muted {
color: #000c;
}
.right { .right {
float: right; float: right;
} }
@ -542,30 +546,12 @@ input[type="file"] {
background: white; background: white;
} }
.open-postform[open] {
z-index: 1;
position: fixed;
top: 4px;
right: 5px;
}
.open-postform[open] + .openpadding {
height: 39px;
}
.open-postform[open] summary:before {
content: "Close";
}
.open-postform summary:before {
content: "Open Post Form";
}
#postform { #postform {
display: none;
max-width: calc(100% - 10px); max-width: calc(100% - 10px);
max-height: calc(100% - 50px); max-height: calc(100% - 50px);
position: fixed; position: fixed;
top: 45px; top: 5px;
right: 5px; right: 5px;
background-color: #D6DAF0; background-color: #D6DAF0;
border: 1px solid #b7c5d9; border: 1px solid #b7c5d9;

@ -52,7 +52,7 @@ module.exports = async (req, res, next) => {
//it was correct, so delete the file, the cookie and reset their quota //it was correct, so delete the file, the cookie and reset their quota
res.clearCookie('captchaid'); res.clearCookie('captchaid');
await Promise.all([ await Promise.all([
Captcha.resetQuota(res.locals.ip), Captchas.resetQuota(res.locals.ip),
remove(`${uploadDirectory}captcha/${captchaId}.jpg`) remove(`${uploadDirectory}captcha/${captchaId}.jpg`)
]); ]);

@ -1,63 +1,62 @@
- const isThread = thread != null - const isThread = thread != null
section.form-wrapper.flex-center section.form-wrapper.flex-center
details.toggle-label.open-postform a.toggle-summary(href='#postform') Open Postform
summary.toggle-summary form.form-post#postform(action=`/forms/board/${board._id}/post`, enctype='multipart/form-data', method='POST')
div#postform input(type='hidden' name='thread' value=isThread ? thread.postId : null)
form.form-post(action=`/forms/board/${board._id}/post`, enctype='multipart/form-data', method='POST') unless board.settings.forceAnon
input(type='hidden' name='thread' value=isThread ? thread.postId : null) section.postform-row
unless board.settings.forceAnon .postform-label Name
section.postform-row input(type='text', name='name', placeholder=board.settings.defaultName autocomplete='off' maxlength='50')
.postform-label Name a.close.postform-style.ml-1(href='#!') X
input(type='text', name='name', placeholder=board.settings.defaultName autocomplete='off' maxlength='50') section.postform-row
section.postform-row .postform-label Subject
.postform-label Subject if !isThread && board.settings.forceOPSubject
if !isThread && board.settings.forceOPSubject .required *
.required * input(type='text', name='subject', autocomplete='off' maxlength='50' required=!isThread && board.settings.forceOPSubject)
input(type='text', name='subject', autocomplete='off' maxlength='50' required=!isThread && board.settings.forceOPSubject) section.postform-row
section.postform-row .postform-label Email
.postform-label Email input(type='text', name='email', autocomplete='off' maxlength='50')
input(type='text', name='email', autocomplete='off' maxlength='50') else
else section.postform-row
section.postform-row .postform-label Sage
.postform-label Sage label.postform-style.ph-5
label.postform-style.ph-5 input(type='checkbox', name='email', value='sage')
input(type='checkbox', name='email', value='sage') | Sage
| Sage a.close.postform-style.ml-1(href='#!') X
if !isThread if !isThread
section.postform-row
.postform-label Subject
if board.settings.forceOPSubject
.required *
input(type='text', name='subject', autocomplete='off' maxlength='50' required=board.settings.forceOPSubject)
section.postform-row section.postform-row
.postform-label Message .postform-label Subject
if !isThread && board.settings.forceOPMessage if board.settings.forceOPSubject
.required * .required *
textarea(name='message', rows='5', autocomplete='off' maxlength='4000' required=!isThread && board.settings.forceOPMessage) input(type='text', name='subject', autocomplete='off' maxlength='50' required=board.settings.forceOPSubject)
if board.settings.maxFiles > 0 section.postform-row
section.postform-row .postform-label Message
.postform-label Files if !isThread && board.settings.forceOPMessage
if !isThread && board.settings.forceOPFile .required *
.required * textarea(name='message', rows='5', autocomplete='off' maxlength='4000' required=!isThread && board.settings.forceOPMessage)
input(type='file', name='file' multiple required=!isThread && board.settings.forceOPFile) if board.settings.maxFiles > 0
if board.settings.userPostSpoiler section.postform-row
label.postform-style.ph-5.ml-1 .postform-label Files
input(type='checkbox', name='spoiler', value='true') if !isThread && board.settings.forceOPFile
| Spoiler .required *
if board.settings.userPostSpoiler || board.settings.userPostDelete || board.settings.userPostUnlink input(type='file', name='file' multiple required=!isThread && board.settings.forceOPFile)
section.postform-row if board.settings.userPostSpoiler
.postform-label Password label.postform-style.ph-5.ml-1
input(type='password', name='password', autocomplete='off' placeholder='password to delete/spoiler/unlink later' maxlength='50') input(type='checkbox', name='spoiler', value='true')
if board.settings.captcha | Spoiler
section.postform-row if board.settings.userPostSpoiler || board.settings.userPostDelete || board.settings.userPostUnlink
.postform-label Captcha section.postform-row
.required * .postform-label Password
.postform-col input(type='password', name='password', autocomplete='off' placeholder='password to delete/spoiler/unlink later' maxlength='50')
iframe.captcha(src='/captcha.html' width=200 height=110 scrolling='no') if board.settings.captcha
input(type='text', name='captcha', autocomplete='off' placeholder='captcha text' maxlength='6' required) section.postform-row
if !isThread && ((board.settings.forceOPFile && board.settings.maxFiles > 0) || board.settings.forceOPMessage || board.settings.forceOPSubject) .postform-label Captcha
small .required *
span.required * .postform-col
| = required field iframe.captcha(src='/captcha.html' width=200 height=110 scrolling='no')
input(type='submit', value=`New ${isThread ? 'Reply' : 'Thread'}`) input(type='text', name='captcha', autocomplete='off' placeholder='captcha text' maxlength='6' required)
.openpadding if !isThread && ((board.settings.forceOPFile && board.settings.maxFiles > 0) || board.settings.forceOPMessage || board.settings.forceOPSubject)
small
span.required *
| = required field
input(type='submit', value=`New ${isThread ? 'Reply' : 'Thread'}`)

@ -1,7 +1,7 @@
mixin post(post, truncate, manage=false, globalmanage=false) mixin post(post, truncate, manage=false, globalmanage=false)
.anchor(id=post.postId) .anchor(id=post.postId)
article(class=`post-container ${post.thread ? '' : 'op'}`) article(class=`post-container ${post.thread ? '' : 'op'}`)
- const postURL = `/${post.board}/thread/${post.thread || post.postId}.html#${post.postId}`; - const postURL = `/${post.board}/thread/${post.thread || post.postId}.html`;
header.post-info header.post-info
label label
if globalmanage if globalmanage
@ -42,7 +42,11 @@ mixin post(post, truncate, manage=false, globalmanage=false)
if post.userId if post.userId
span.user-id(style=`background: #${post.userId}`) #{post.userId} span.user-id(style=`background: #${post.userId}`) #{post.userId}
| |
span: a(href=postURL) No.#{post.postId} span: a(href=`${postURL}#${post.postId}`) No.
span: a(href=`${postURL}#postform`) #{post.postId}
if !post.thread
|
span: a(href=`/${post.board}/thread/${post.thread || post.postId}.html#postform`) [Reply]
.post-data .post-data
if post.files.length > 0 if post.files.length > 0
.post-files .post-files
@ -79,13 +83,15 @@ mixin post(post, truncate, manage=false, globalmanage=false)
} }
pre.post-message !{truncatedMessage} pre.post-message !{truncatedMessage}
if truncatedMessage !== post.message if truncatedMessage !== post.message
blockquote Message too long. #[a(href=postURL) View the full text] blockquote.muted Message too long. #[a(href=`${postURL}#${post.postId}`) View the full text]
else else
pre.post-message !{post.message} pre.post-message !{post.message}
if !post.message && post.files.length === 0
blockquote.muted Post file(s) unlinked
if post.banmessage if post.banmessage
blockquote.banmessage USER WAS BANNED FOR THIS POST (#{post.banmessage}) blockquote.banmessage USER BANNED FOR THIS POST (#{post.banmessage || 'No reason specified'})
if post.omittedposts || post.omittedimages if post.omittedposts || post.omittedimages
blockquote #{post.omittedposts} post(s)#{post.omittedimages > 0 ? ' and '+post.omittedimages+' image(s)' : ''} omitted. #[a(href=postURL) View the full thread] blockquote.muted #{post.omittedposts} post(s)#{post.omittedimages > 0 ? ' and '+post.omittedimages+' image(s)' : ''} omitted. #[a(href=`${postURL}#${post.postId}`) View the full thread]
if post.backlinks && post.backlinks.length > 0 if post.backlinks && post.backlinks.length > 0
.replies Replies: .replies Replies:
each backlink in post.backlinks each backlink in post.backlinks

@ -6,8 +6,11 @@ block head
block content block content
h1.board-title Banned! h1.board-title Banned!
h4.board-description Bans currently in place against your IP: .table-container.flex-center.mv-10
hr(size=1) table.table-body
for ban in bans tr.table-head
+ban(ban) th Bans currently in place against your IP:
hr(size=1) for ban in bans
tr.table-row
td
+ban(ban)

Loading…
Cancel
Save