small changes

This commit is contained in:
b1ek 2023-02-20 14:07:48 +10:00
parent e4cdc78e1f
commit c3bc8d767e
3 changed files with 6 additions and 11 deletions

View File

@ -35,7 +35,7 @@
.gb_hidden_mail { .gb_hidden_mail {
display:inline-block; display:inline-block;
height:9.5pt; height:10pt;
border-radius:4px; border-radius:4px;
background:#666d65; background:#666d65;
transform: translateY(1px); transform: translateY(1px);

View File

@ -16,7 +16,7 @@ async function handler(req, res, next) {
const errors = req.query.error; const errors = req.query.error;
let sqldata = await Sequelize.Guestbook.findAll({ const data = await Sequelize.Guestbook.findAll({
where: { where: {
hidden: false hidden: false
}, },
@ -24,13 +24,8 @@ async function handler(req, res, next) {
['id', 'DESC'] ['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', { res.send(await Helpers.ViewLoader.load('guestbook.pug', {
current_route: req.originalUrl, current_route: req.originalUrl,

View File

@ -87,11 +87,11 @@ block content
else else
table(class='gb_entries') table(class='gb_entries')
each entry, i in data each entry, i in data
tr(id='gb_entry_' + id) tr(id='gb_entry_' + entry.id)
td(width='20%' class='gb_sender_data') td(width='20%' class='gb_sender_data')
p(style='font-size:9pt') p(style='font-size:9pt')
| ID: | ID:
a(href='gb_entry_' + entry.id) ##{entry.id} a(href='#gb_entry_' + entry.id) ##{entry.id}
br br
| Sender: #{entry.name} | Sender: #{entry.name}
br br
@ -108,7 +108,7 @@ block content
if (ip == entry.ip && Math.floor(Date.now() / 1000) - entry.time <= (60 * 60 * 24)) if (ip == entry.ip && Math.floor(Date.now() / 1000) - entry.time <= (60 * 60 * 24))
p(style='margin:0;padding:0;padding-bottom:12px') 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') td(width='80%' class='gb_entry_text')
p(class='gb_entry_text_title') Message: p(class='gb_entry_text_title') Message:
p(style='margin:0;padding:0;font-size:10pt'). p(style='margin:0;padding:0;font-size:10pt').