From 19888e2668254b2c3dac14edeb0e334a6b2a12b4 Mon Sep 17 00:00:00 2001 From: b1ek Date: Sat, 4 Mar 2023 16:54:26 +1000 Subject: [PATCH] add submitted count --- routes/main.js | 2 +- views/main.pug | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/routes/main.js b/routes/main.js index 490fa8a..e0dd3c7 100644 --- a/routes/main.js +++ b/routes/main.js @@ -6,7 +6,7 @@ const content = require('../helpers/content'); async function index(req, res) { res.render('main', { maxlen: process.env.MAXLEN, - exceeded: content.submitted() >= process.env.MAXFILES + submitted: content.submitted() }); } diff --git a/views/main.pug b/views/main.pug index 8269ab2..0b1f0ae 100644 --- a/views/main.pug +++ b/views/main.pug @@ -1,6 +1,7 @@ extends template/main.pug block content + - var exceeded = submitted >= process.env.MAXFILES form(action='/upload' method='POST') p(align='center') textarea(name='text' class='data' placeholder='Put your text in here!' + (maxlen ? ` (Max length is ${maxlen} bytes)` : '')) @@ -17,4 +18,9 @@ block content br br | Admin email is: - a(href='mailto:' + email)= email \ No newline at end of file + a(href='mailto:' + email)= email + else + p(align='center') + | Files: + | #{submitted}/#{process.env.MAXFILES} + | (#{Math.floor((submitted * 10000)/process.env.MAXFILES) / 100}%) \ No newline at end of file