From c3bc8d767eef881779e37fd1ea63ee94dbaa9db3 Mon Sep 17 00:00:00 2001 From: b1ek Date: Mon, 20 Feb 2023 14:07:48 +1000 Subject: [PATCH] small changes --- public/static/ui/gb_ui.css | 2 +- routes/guestbook.js | 9 ++------- view/guestbook.pug | 6 +++--- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/public/static/ui/gb_ui.css b/public/static/ui/gb_ui.css index 624e7ab..0d8a424 100644 --- a/public/static/ui/gb_ui.css +++ b/public/static/ui/gb_ui.css @@ -35,7 +35,7 @@ .gb_hidden_mail { display:inline-block; - height:9.5pt; + height:10pt; border-radius:4px; background:#666d65; transform: translateY(1px); diff --git a/routes/guestbook.js b/routes/guestbook.js index a705648..4639fe6 100644 --- a/routes/guestbook.js +++ b/routes/guestbook.js @@ -16,7 +16,7 @@ async function handler(req, res, next) { const errors = req.query.error; - let sqldata = await Sequelize.Guestbook.findAll({ + const data = await Sequelize.Guestbook.findAll({ where: { hidden: false }, @@ -24,13 +24,8 @@ async function handler(req, res, next) { ['id', 'DESC'] ] }); - if (!sqldata) throw new Error('Failed to get guestbook entries'); + if (!data) throw new Error('Failed to get guestbook entries'); - /*for (let i = 0; i != sqldata.length; i++) { - data[sqldata[i].id] = sqldata[i]; - }*/ - - const data = sqldata; res.send(await Helpers.ViewLoader.load('guestbook.pug', { current_route: req.originalUrl, diff --git a/view/guestbook.pug b/view/guestbook.pug index e3534a9..d1c52d8 100644 --- a/view/guestbook.pug +++ b/view/guestbook.pug @@ -87,11 +87,11 @@ block content else table(class='gb_entries') each entry, i in data - tr(id='gb_entry_' + id) + tr(id='gb_entry_' + entry.id) td(width='20%' class='gb_sender_data') p(style='font-size:9pt') | ID: - a(href='gb_entry_' + entry.id) ##{entry.id} + a(href='#gb_entry_' + entry.id) ##{entry.id} br | Sender: #{entry.name} br @@ -108,7 +108,7 @@ block content if (ip == entry.ip && Math.floor(Date.now() / 1000) - entry.time <= (60 * 60 * 24)) p(style='margin:0;padding:0;padding-bottom:12px') - a(href='/guestbook/del/' + id class='gb_record_del_btn' title='you can delete your own messages') delete + a(href='/guestbook/del/' + entry.id class='gb_record_del_btn' title='you can delete your own messages') delete td(width='80%' class='gb_entry_text') p(class='gb_entry_text_title') Message: p(style='margin:0;padding:0;font-size:10pt').