diff --git a/public/css/main.css b/public/css/main.css index 6147684..1fb6208 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -94,3 +94,15 @@ header { justify-content: center; } +.image_box { + position: relative; +} + +.remove { + position: absolute; + top: 0.2em; + right: 0.2em; + text-decoration: none; + color: initial; +} + diff --git a/routes/remove.js b/routes/remove.js index ad883a1..c446625 100644 --- a/routes/remove.js +++ b/routes/remove.js @@ -6,7 +6,7 @@ let fs = require("fs"); router.get("/:name", isAuth, (req, res, next) => { if ("name" in req.params && fs.existsSync("./images/"+req.params.name)) { fs.unlinkSync("./images/"+req.params.name); - res.redirect("/"); + res.redirect("/list"); } else { next(); } diff --git a/views/list.pug b/views/list.pug index 9259c59..70e9ab7 100644 --- a/views/list.pug +++ b/views/list.pug @@ -3,5 +3,7 @@ block content h1 Images List div.images each image in images - img.image(src=`/images/${image}`) + div.image_box + a.remove(href=`/remove/${image}`) X + img.image(src=`/images/${image}`)