template improvements and no need to pass board to post mixin

merge-requests/208/head
fatchan 5 years ago
parent 3c327862d9
commit e8be5ea7b7
  1. 7
      views/includes/boardheader.pug
  2. 6
      views/includes/navbar.pug
  3. 16
      views/mixins/ban.pug
  4. 6
      views/mixins/post.pug
  5. 15
      views/pages/ban.pug
  6. 4
      views/pages/board.pug
  7. 1
      views/pages/login.pug
  8. 63
      views/pages/manage.pug
  9. 4
      views/pages/thread.pug

@ -1,3 +1,4 @@
a.no-decoration(href=`/${board._id}`)
h1.board-title /#{board._id}/ - #{board.name}
h4.board-description #{board.description}
section.board-header
a.no-decoration(href=`/${board._id}`)
h1.board-title /#{board._id}/ - #{board.name}
h4.board-description #{board.description}

@ -1,5 +1,7 @@
nav.navbar
a.nav-item(href='/') Home
a.nav-item(href='/login') Login
if board
a.nav-item(href=`/${board._id}/manage`) Manage Board
a.nav-item.right(href=`/${board._id}/manage`) Manage Board
a.nav-item.right(href='/logout') Logout
a.nav-item.right(href='/register') Register
a.nav-item.right(href='/login') Login

@ -0,0 +1,16 @@
include ./post.pug
mixin ban(ban)
if ban.board
div Board: #[a(href=`/${ban.board}`) /#{ban.board}/]
else
div Global ban.
div Reason: #{ban.reason}
div Issuer: #{ban.issuer}
div Date: #{ban.date}
div Expiry: #{ban.expireAt}
if ban.post
span Post:
section.thread
+post(ban.post, false)

@ -1,4 +1,4 @@
mixin post(board, post, truncate, showreports)
mixin post(post, truncate, showreports)
article(id=post.postId class='post-container '+(post.thread ? '' : 'op'))
header.post-info
input.post-check(type='checkbox', name='checked[]' value=post.postId)
@ -11,7 +11,7 @@ mixin post(board, post, truncate, showreports)
span.post-name #{post.name}
span #{post.date.toLocaleString()}
span.user-id(style=`background: #${post.userId}`) #{post.userId}
span: a(href=`/${board._id}/thread/${post.thread ? post.thread : post.postId}#${post.postId}`) ##{post.postId}
span: a(href=`/${post.board}/thread/${post.thread ? post.thread : post.postId}#${post.postId}`) ##{post.postId}
if post.files.length > 0
.post-files
each file in post.files
@ -39,7 +39,7 @@ mixin post(board, post, truncate, showreports)
}
if truncated
blockquote.post-message !{truncatedMessage}
p Message too long. #[a(href=`/${board._id}/thread/${post.thread == null ? post.postId : post.thread}#${post.postId}`) Click here] to view the full text.
p Message too long. #[a(href=`/${post.board}/thread/${post.thread == null ? post.postId : post.thread}#${post.postId}`) Click here] to view the full text.
else
blockquote.post-message !{post.message}
else

@ -1,5 +1,5 @@
extends ../layout.pug
include ../mixins/post.pug
include ../mixins/ban.pug
block head
title Banned!
@ -10,16 +10,5 @@ block content
Bans currently in place against your IP:
hr(size=1)
for ban in bans
if ban.board
div Board: #[a(href=`/${ban.board}`) /#{ban.board}/]
else
div Global ban.
div Reason: #{ban.reason}
div Issuer: #{ban.issuer}
div Date: #{ban.date}
div Expiry: #{ban.expireAt}
if ban.post
span Post:
section.thread
+post(ban.post.board, ban.post, false)
+ban(ban)
hr(size=1)

@ -17,9 +17,9 @@ block content
hr(size=1)
for thread in threads
section.thread
+post(board, thread, true)
+post(thread, true)
for post in thread.replies
+post(board, post, true)
+post(post, true)
hr(size=1)
if pages > 0
span.pages Page

@ -7,6 +7,7 @@ block content
section.form-wrapper
form.form-post(action='/forms/login' method='POST')
input(type='hidden' name='_csrf' value=csrf)
input(type='hidden' name='redirect' value=redirect)
input#username(type='text', name='username', placeholder='username' maxlength='50')
input#password(type='password', name='password', placeholder='password' maxlength='100')
input(type='submit', value='submit')

@ -1,5 +1,6 @@
extends ../layout.pug
include ../mixins/post.pug
include ../mixins/ban.pug
block head
title Manage
@ -7,38 +8,48 @@ block head
block content
include ../includes/boardheader.pug
hr(size=1)
h4.board-description Management Panel
form(action='/forms/board/'+board._id+'/posts' method='POST' enctype='application/x-www-form-urlencoded')
h4 Reports:
form(action=`/forms/board/${board._id}/posts` method='POST' enctype='application/x-www-form-urlencoded')
input(type='hidden' name='_csrf' value=csrf)
if posts.length === 0
p No reports.
hr(size=1)
for post in posts
section.thread
+post(board, post, false, true)
+post(post, false, true)
hr(size=1)
section.action-wrapper
span
label
input.post-check(type='checkbox', name='delete' value=1)
| Delete
span
label
input.post-check(type='checkbox', name='spoiler' value=1)
| Spoiler
span
label
input.post-check(type='checkbox', name='dismiss' value=1)
| Dismiss
span
label
input.post-check(type='checkbox', name='ban' value=1)
| Ban
label
input.post-check(type='checkbox', name='global_ban' value=1)
| Global Ban
label
input#report(type='text', name='reason', placeholder='ban reason' autocomplete='off')
label
input.post-check(type='checkbox', name='delete' value=1)
| Delete Post
label
input.post-check(type='checkbox', name='spoiler' value=1)
| Spoiler Images
label
input.post-check(type='checkbox', name='dismiss' value=1)
| Dismiss Reports
label
input.post-check(type='checkbox', name='ban' value=1)
| Ban Poster
label
input.post-check(type='checkbox', name='global_ban' value=1)
| Global Ban Poster
label
input.post-check(type='checkbox', name='preserve_post' value=1)
| Show Post In Ban
label
input#report(type='text', name='reason', placeholder='ban reason' autocomplete='off')
input(type='submit', value='submit')
hr(size=1)
h4 Bans:
form(action=`/forms/board/${board._id}/unban` method='POST' enctype='application/x-www-form-urlencoded')
input(type='hidden' name='_csrf' value=csrf)
if bans.length === 0
p No bans.
hr(size=1)
for ban in bans
section.thread
+ban(ban)
hr(size=1)
//section.action-wrapper
input(type='submit', value='unban')

@ -18,8 +18,8 @@ block content
form(action='/forms/board/'+board._id+'/posts' method='POST' enctype='application/x-www-form-urlencoded')
input(type='hidden' name='_csrf' value=csrf)
section.thread
+post(board, thread)
+post(thread)
for post in thread.replies
+post(board, post)
+post(post)
hr(size=1)
include ../includes/deletefooter.pug

Loading…
Cancel
Save