From 830d0cc40e880c499985fed93eb90c5da47ca262 Mon Sep 17 00:00:00 2001 From: fatchan Date: Tue, 10 Sep 2019 23:33:59 +0000 Subject: [PATCH] bans now shown in table format, better in future if public ban list needed --- controllers/forms/removebans.js | 2 +- gulp/res/css/style.css | 15 ++++++- views/includes/bantable.pug | 13 ++++++ views/mixins/ban.pug | 53 +++++++++++++---------- views/mixins/managenav.pug | 2 +- views/mixins/post.pug | 2 +- views/pages/ban.pug | 39 +++++++---------- views/pages/globalmanage.pug | 8 ++-- views/pages/managebans.pug | 7 ++- views/pages/managesettings.pug | 76 ++++++++++++++++----------------- 10 files changed, 120 insertions(+), 97 deletions(-) create mode 100644 views/includes/bantable.pug diff --git a/controllers/forms/removebans.js b/controllers/forms/removebans.js index 590c6268..f17d9fc5 100644 --- a/controllers/forms/removebans.js +++ b/controllers/forms/removebans.js @@ -11,7 +11,7 @@ module.exports = async (req, res, next) => { errors.push('Must select 1-10 bans') } - const redirect = req.params.board ? `/${req.params.board}/manage.html` : '/globalmanage.html'; + const redirect = req.params.board ? `/${req.params.board}/manage/bans.html` : '/globalmanage.html'; if (errors.length > 0) { return res.status(400).render('message', { diff --git a/gulp/res/css/style.css b/gulp/res/css/style.css index dd9e0c4f..1083778c 100644 --- a/gulp/res/css/style.css +++ b/gulp/res/css/style.css @@ -210,6 +210,19 @@ p { background: black!important; /*for detected coloring*/ } +.banposts .thread { + display: none; + text-align: left; +} + +.banposts:hover .thread { + display: block; + position: fixed; + z-index: 1; + left:0; + right:0; +} + .banmessage { color: red; font-weight: bold; @@ -500,7 +513,7 @@ textarea { text-align: left; } -.post-container, .ban { +.post-container { box-sizing: border-box; padding: .5em; max-width: 100%; diff --git a/views/includes/bantable.pug b/views/includes/bantable.pug new file mode 100644 index 00000000..d70d3da6 --- /dev/null +++ b/views/includes/bantable.pug @@ -0,0 +1,13 @@ +.table-container.flex-center.mv-10.text-center + table(style='width:100%;') + tr + th + th Board + th Reason + th IP + th Issuer + th Issue Date + th Expiry + th Post(s) + th Appealable? + th Appeal diff --git a/views/mixins/ban.pug b/views/mixins/ban.pug index 8bd1030c..99dad634 100644 --- a/views/mixins/ban.pug +++ b/views/mixins/ban.pug @@ -1,27 +1,34 @@ include ./post.pug - mixin ban(ban, banpage) - .ban - if !banpage || (ban.appeal == null && ban.allowAppeal === true) - input.post-check(type='checkbox', name='checkedbans[]' value=ban._id) - span - | Banned + tr + td + if !banpage || (ban.appeal == null && ban.allowAppeal === true) + input.post-check(type='checkbox', name='checkedbans[]' value=ban._id) + td if ban.board - | from #[a(href=`/${ban.board}/`) /#{ban.board}/] + a(href=`/${ban.board}/`) /#{ban.board}/ else - | globally - | for: #{ban.reason} - div Issued by: #{ban.issuer} - div Issued against: ...#{ban.ip.slice(-10)} - div Banned: #{ban.date.toLocaleString(undefined, {hour12:false})} - div Expires: #{ban.expireAt.toLocaleString()} - if ban.posts && ban.posts.length > 0 - span Banned for the following post#{ban.posts.length > 1 ? 's' : ''}: - section.thread - each p in ban.posts - +post(p, false, false, false, true) - if ban.appeal != null - div Submitted appeal: - textarea(disabled='true') #{ban.appeal} - if !ban.allowAppeal - div This ban was issued as non-appealable. + | Global + td= ban.reason + td ...#{ban.ip.slice(-10)} + td= ban.issuer + td= ban.date.toLocaleString(undefined, {hour12:false}) + td= ban.expireAt.toLocaleString() + td.banposts + if ban.posts && ban.posts.length > 0 + | Hover to view + section.thread + each p in ban.posts + +post(p, false, false, false, true) + else + Posts not shown + td + if ban.allowAppeal + | ✓ + else + | ⨯ + td + if ban.appeal + textarea(rows=1 disabled='true') #{ban.appeal} + else if ban.allowAppeal + | No appeal submitted diff --git a/views/mixins/managenav.pug b/views/mixins/managenav.pug index b448789e..04f9ca28 100644 --- a/views/mixins/managenav.pug +++ b/views/mixins/managenav.pug @@ -1,4 +1,4 @@ -mixin managenav(selectedDL) +mixin managenav(selected) nav.pages a(href=`/${board._id}/manage/reports.html` class=(selected === 'reports' ? 'bold' : '')) [Reports] | diff --git a/views/mixins/post.pug b/views/mixins/post.pug index d606395c..236bb126 100644 --- a/views/mixins/post.pug +++ b/views/mixins/post.pug @@ -1,7 +1,7 @@ include ./report.pug mixin post(post, truncate, manage=false, globalmanage=false, ban=false) .anchor(id=post.postId) - article(class=`post-container ${post.thread ? '' : 'op'}`) + article(class=`post-container ${post.thread || ban === true ? '' : 'op'}`) - const postURL = `/${post.board}/thread/${post.thread || post.postId}.html`; header.post-info label diff --git a/views/pages/ban.pug b/views/pages/ban.pug index 5757f15e..a6b200d7 100644 --- a/views/pages/ban.pug +++ b/views/pages/ban.pug @@ -8,27 +8,20 @@ block head block content h1.board-title Banned! + h4.board-description Bans currently in place against your IP: form.form-post(action=`/forms/appeal`, enctype='application/x-www-form-urlencoded', method='POST') - .table-container.flex-center.mv-10 - table - tr - th Bans currently in place against your IP: - if bans.length > 0 - for ban in bans - tr - td - +ban(ban, true) - if allowAppeal === true - tr - td - h4.no-m-p Appeal bans: - section.form-wrapper.flexleft.mt-10 - input(type='hidden' name='_csrf' value=csrf) - section.row - .label Message - textarea(name='message' required) - section.row - .label Captcha - span.col - include ../includes/captcha.pug - input(type='submit', value='submit') + include ../includes/bantable.pug + for ban in bans + +ban(ban, true) + if allowAppeal === true + h4.no-m-p Appeal bans: + section.form-wrapper.flexleft.mt-10 + input(type='hidden' name='_csrf' value=csrf) + section.row + .label Message + textarea(rows=1 name='message' required) + section.row + .label Captcha + span.col + include ../includes/captcha.pug + input(type='submit', value='submit') diff --git a/views/pages/globalmanage.pug b/views/pages/globalmanage.pug index 7ece8d85..3345221e 100644 --- a/views/pages/globalmanage.pug +++ b/views/pages/globalmanage.pug @@ -87,11 +87,9 @@ block content input(type='hidden' name='_csrf' value=csrf) if bans.length === 0 p No bans. - hr(size=1) else - for ban in bans - section.thread + include ../includes/bantable.pug + for ban in bans +ban(ban) - hr(size=1) section.action-wrapper - input(type='submit', value='unban') + input(type='submit', value='unban') diff --git a/views/pages/managebans.pug b/views/pages/managebans.pug index 364ee739..25074c1c 100644 --- a/views/pages/managebans.pug +++ b/views/pages/managebans.pug @@ -20,10 +20,9 @@ block content if bans.length === 0 p No bans. else - for ban in bans - section.thread + include ../includes/bantable.pug + for ban in bans +ban(ban) - hr(size=1) section.action-wrapper - input(type='submit', value='unban') + input(type='submit', value='unban') diff --git a/views/pages/managesettings.pug b/views/pages/managesettings.pug index 46dac26f..6325d75e 100644 --- a/views/pages/managesettings.pug +++ b/views/pages/managesettings.pug @@ -17,7 +17,7 @@ block content section.form-wrapper.flexleft.mt-10 form.form-post(action=`/forms/board/${board._id}/transfer`, enctype='application/x-www-form-urlencoded', method='POST') input(type='hidden' name='_csrf' value=csrf) - section.row + .row .label New owner username input(type='text' name='username' placeholder=board.owner required) input(type='submit', value='submit') @@ -26,11 +26,11 @@ block content section.form-wrapper.flexleft.mt-10 form.form-post(action=`/forms/board/${board._id}/deleteboard`, enctype='application/x-www-form-urlencoded', method='POST') input(type='hidden' name='_csrf' value=csrf) - section.row + .row .label I'm sure label.postform-style.ph-5 input(type='checkbox', name='confirm', value='true' required) - section.row + .row .label Board URI input(type='text' name='uri' required) input(type='submit', value='submit') @@ -39,138 +39,138 @@ block content section.form-wrapper.flexleft.mt-10 form.form-post(action=`/forms/board/${board._id}/settings` method='POST' enctype='application/x-www-form-urlencoded') input(type='hidden' name='_csrf' value=csrf) - section.row + .row .label Board name input(type='text' name='name' value=board.settings.name) - section.row + .row .label Board Description input(type='text' name='description' value=board.settings.description) - section.row + .row .label Tags textarea(name='tags' placeholder='newline separated, max 10') #{board.settings.tags.join('\n')} - section.row + .row .label Announcement textarea(name='announcement' placeholder='supports post styling') #{board.settings.announcement.raw} - section.row + .row .label Anon Name input(type='text' name='default_name' value=board.settings.defaultName) - section.row + .row .label Max Files input(type='number' name='max_files' value=board.settings.maxFiles max=globalLimits.postFiles.max) - section.row + .row .label Allow Video Files label.postform-style.ph-5 input(type='checkbox', name='files_allow_video', value='true' checked=board.settings.allowedFileTypes.video) - section.row + .row .label Allow Image Files label.postform-style.ph-5 input(type='checkbox', name='files_allow_image', value='true' checked=board.settings.allowedFileTypes.image) - section.row + .row .label Allow Animated Image Files label.postform-style.ph-5 input(type='checkbox', name='files_allow_animated_image', value='true' checked=board.settings.allowedFileTypes.animatedImage) - section.row + .row .label Early 404 label.postform-style.ph-5 input(type='checkbox', name='early404', value='true' checked=board.settings.early404) - section.row + .row .label IDs label.postform-style.ph-5 input(type='checkbox', name='ids', value='true' checked=board.settings.ids) - section.row + .row .label Geo Flags label.postform-style.ph-5 input(type='checkbox', name='flags', value='true' checked=board.settings.flags) - section.row + .row .label User Post Deletion label.postform-style.ph-5 input(type='checkbox', name='user_post_delete', value='true' checked=board.settings.userPostDelete) - section.row + .row .label User File Spoilering label.postform-style.ph-5 input(type='checkbox', name='user_post_spoiler', value='true' checked=board.settings.userPostSpoiler) - section.row + .row .label User File Unlinking label.postform-style.ph-5 input(type='checkbox', name='user_post_unlink', value='true' checked=board.settings.userPostUnlink) - section.row + .row .label Force Anon label.postform-style.ph-5 input(type='checkbox', name='force_anon', value='true' checked=board.settings.forceAnon) - section.row + .row .label Force Thread Subject label.postform-style.ph-5 input(type='checkbox', name='force_thread_subject', value='true' checked=board.settings.forceThreadSubject) - section.row + .row .label Force Thread Message label.postform-style.ph-5 input(type='checkbox', name='force_thread_message', value='true' checked=board.settings.forceThreadMessage) - section.row + .row .label Force Thread File label.postform-style.ph-5 input(type='checkbox', name='force_thread_file', value='true' checked=board.settings.forceThreadFile) - section.row + .row .label Force Reply Message label.postform-style.ph-5 input(type='checkbox', name='force_reply_message', value='true' checked=board.settings.forceReplyMessage) - section.row + .row .label Force Reply File label.postform-style.ph-5 input(type='checkbox', name='force_reply_file', value='true' checked=board.settings.forceReplyFile) - section.row + .row .label Min Thread Message Length input(type='number' name='min_thread_message_length' value=board.settings.minThreadMessageLength max=globalLimits.messageLength.max) - section.row + .row .label Min Reply Message Length input(type='number' name='min_reply_message_length' value=board.settings.minReplyMessageLength max=globalLimits.messageLength.max) - section.row + .row .label Thread Limit input(type='number' name='thread_limit' value=board.settings.threadLimit min=globalLimits.threadLimit.min max=globalLimits.threadLimit.max) - section.row + .row .label Reply Limit input(type='number' name='reply_limit' value=board.settings.replyLimit min=globalLimits.replyLimit.min max=globalLimits.replyLimit.max) - section.row + .row .label Moderators textarea(name='moderators' placeholder='newline separated, max 10') #{board.settings.moderators.join('\n')} - section.row + .row .label Board Locked label.postform-style.ph-5 input(type='checkbox', name='locked', value='true' checked=board.settings.locked) - section.row + .row .label Unlisted label.postform-style.ph-5 input(type='checkbox', name='unlisted', value='true' checked=board.settings.unlisted) - section.row + .row .label Theme select(name='theme') each theme in themes option(value=theme selected=board.settings.theme === theme) #{theme} - section.row + .row .label Captcha Mode select(name='captcha_mode') option(value='0', selected=board.settings.captchaMode === 0) No Captcha option(value='1', selected=board.settings.captchaMode === 1) Captcha for new thread option(value='2', selected=board.settings.captchaMode === 2) Captcha for all posts - section.row + .row .label TPH Trigger Threshold input(type='number', name='tph_trigger', value=board.settings.tphTrigger) - section.row + .row .label TPH Trigger Action select(name='tph_trigger_action') option(value='0', selected=board.settings.tphTriggerAction === 0) Do nothing option(value='1', selected=board.settings.tphTriggerAction === 1) Enable captcha for new thread option(value='2', selected=board.settings.tphTriggerAction === 2) Enable captcha for all posts option(value='3', selected=board.settings.tphTriggerAction === 3) Lock Board - section.row + .row .label Filters textarea(name='filters' placeholder='newline separated, max 50') #{board.settings.filters.join('\n')} - section.row + .row .label Filter Mode select(name='filter_mode') option(value='0', selected=board.settings.filterMode === 0) Do nothing option(value='1', selected=board.settings.filterMode === 1) Block post option(value='2', selected=board.settings.filterMode === 2) Auto ban - section.row + .row .label Filter Auto Ban Duration input(type='text' name='ban_duration' placeholder='e.g. 1w' value=board.settings.filterBanDuration) input(type='submit', value='save settings')