Add X button for delete on images list

This commit is contained in:
Ethanell 2020-04-29 09:45:34 +02:00
parent 8dca471571
commit bb5ea716c6
3 changed files with 16 additions and 2 deletions

View file

@ -94,3 +94,15 @@ header {
justify-content: center; justify-content: center;
} }
.image_box {
position: relative;
}
.remove {
position: absolute;
top: 0.2em;
right: 0.2em;
text-decoration: none;
color: initial;
}

View file

@ -6,7 +6,7 @@ let fs = require("fs");
router.get("/:name", isAuth, (req, res, next) => { router.get("/:name", isAuth, (req, res, next) => {
if ("name" in req.params && fs.existsSync("./images/"+req.params.name)) { if ("name" in req.params && fs.existsSync("./images/"+req.params.name)) {
fs.unlinkSync("./images/"+req.params.name); fs.unlinkSync("./images/"+req.params.name);
res.redirect("/"); res.redirect("/list");
} else { } else {
next(); next();
} }

View file

@ -3,5 +3,7 @@ block content
h1 Images List h1 Images List
div.images div.images
each image in images each image in images
img.image(src=`/images/${image}`) div.image_box
a.remove(href=`/remove/${image}`) X
img.image(src=`/images/${image}`)