From 4ebe5880c400f3a6d60860a5dd927a0ce85e5e8c Mon Sep 17 00:00:00 2001 From: flifloo Date: Mon, 17 Aug 2020 19:13:00 +0200 Subject: [PATCH] Update pages title --- app.js | 4 ++-- routes/admin/commands.js | 2 +- routes/admin/index.js | 7 ++++++- routes/{orders.js => commands.js} | 2 +- routes/index.js | 2 +- routes/login.js | 2 +- routes/profile.js | 2 +- routes/register.js | 2 +- routes/sandwiches.js | 2 +- views/{orders.pug => commands.pug} | 2 +- views/layout.pug | 2 +- 11 files changed, 17 insertions(+), 12 deletions(-) rename routes/{orders.js => commands.js} (90%) rename views/{orders.pug => commands.pug} (94%) diff --git a/app.js b/app.js index 4d1740c..8f8e8f5 100644 --- a/app.js +++ b/app.js @@ -10,7 +10,7 @@ let registerRouter = require("./routes/register"); let loginRouter = require("./routes/login"); let logoutRouter = require("./routes/logout"); let commandRouter = require("./routes/command"); -let ordersRouter = require("./routes/orders"); +let ordersRouter = require("./routes/commands"); let sandwichesRouter = require("./routes/sandwiches"); let profileRouter = require("./routes/profile"); let adminRouter = require("./routes/admin"); @@ -43,7 +43,7 @@ app.use("/register", registerRouter); app.use("/login", loginRouter); app.use("/logout", logoutRouter); app.use("/command", commandRouter); -app.use("/orders", ordersRouter); +app.use("/commands", ordersRouter); app.use("/sandwiches", sandwichesRouter); app.use("/profile", profileRouter); app.use("/admin", adminRouter); diff --git a/routes/admin/commands.js b/routes/admin/commands.js index 5e29642..42b4db3 100644 --- a/routes/admin/commands.js +++ b/routes/admin/commands.js @@ -6,7 +6,7 @@ let models = require("../../models"); router.get("/", sessionCheck(3), async (req, res) => { res.render("admin/commands", { - title: "SOD", + title: "SOD - Commands administration", user: req.session.user, commands: await models.Command.findAll({include: models.Sandwich, order: ["date"]}) }); diff --git a/routes/admin/index.js b/routes/admin/index.js index 97a87bd..af72cf4 100644 --- a/routes/admin/index.js +++ b/routes/admin/index.js @@ -5,7 +5,12 @@ let models = require("../../models"); router.get("/", sessionCheck(3), async (req, res) => { - res.render("admin/index", {title: "SOD", user: req.session.user, sandwiches: await models.Sandwich.findAll(), users: await models.User.findAll()}); + res.render("admin/index", { + title: "SOD - Administration", + user: req.session.user, + sandwiches: await models.Sandwich.findAll(), + users: await models.User.findAll() + }); }); module.exports = router; diff --git a/routes/orders.js b/routes/commands.js similarity index 90% rename from routes/orders.js rename to routes/commands.js index f2d5265..e4b8138 100644 --- a/routes/orders.js +++ b/routes/commands.js @@ -23,7 +23,7 @@ router.get("/", sessionCheck(2), async (req, res) => { commands[i.Command.DepartmentName][name][i.Command.id] = [] commands[i.Command.DepartmentName][name][i.Command.id].push(i); } - res.render("orders", {title: "SOD", user: req.session.user, commands: commands, date: date}); + res.render("commands", {title: "SOD - Commands", user: req.session.user, commands: commands, date: date}); }); module.exports = router; diff --git a/routes/index.js b/routes/index.js index 87bec13..f6543a2 100644 --- a/routes/index.js +++ b/routes/index.js @@ -5,7 +5,7 @@ let models = require("../models"); router.get("/", async (req, res) => { let departments = await models.Department.findAll(); let sandwiches = await models.Sandwich.findAll(); - res.render("index", { title: "SOD", user: req.session.user, departments: departments, sandwiches: sandwiches }); + res.render("index", { title: "SOD - Home", user: req.session.user, departments: departments, sandwiches: sandwiches }); }); module.exports = router; diff --git a/routes/login.js b/routes/login.js index f90a3cc..4f3ac17 100644 --- a/routes/login.js +++ b/routes/login.js @@ -6,7 +6,7 @@ router.get("/", async (req, res) => { if (req.session.user) res.redirect("/") else - res.render("login", { title: "Kfet - Login" }); + res.render("login", { title: "SOD - Login" }); }) .post("/", async (req, res) => { if (!req.body.username || !req.body.password) diff --git a/routes/profile.js b/routes/profile.js index fc8e302..c699955 100644 --- a/routes/profile.js +++ b/routes/profile.js @@ -5,7 +5,7 @@ let models = require("../models"); router.get("/", sessionCheck(0), async (req, res) => { res.render("profile", { - title: "SOD", + title: "SOD - Profile", user: req.session.user, departments: await models.Department.findAll(), commands: await models.Command.findAll({ diff --git a/routes/register.js b/routes/register.js index ea41908..2b54c61 100644 --- a/routes/register.js +++ b/routes/register.js @@ -7,7 +7,7 @@ router.get("/", async (req, res) => { if (req.session.user) res.redirect("/"); else - res.render("register", {title: "SOD", departments: await models.Department.findAll()}); + res.render("register", {title: "SOD - register", departments: await models.Department.findAll()}); }) .post("/", async (req, res) => { if (!req.body.username || !req.body.email || !req.body.firstName || !req.body.lastName || diff --git a/routes/sandwiches.js b/routes/sandwiches.js index 0d90d19..974ca92 100644 --- a/routes/sandwiches.js +++ b/routes/sandwiches.js @@ -9,7 +9,7 @@ router.get("/", sessionCheck(1), async (req, res) => { let date = req.query.date ? req.query.date : (new Date()).toISOString().substring(0,10); res.render("sandwiches", { - title: "SOD", + title: "SOD - Sandwiches", user: req.session.user, sandwiches: await models.SandwichCommand.findAll({ attributes: ["SandwichName", [sequelize.fn("COUNT", sequelize.col("SandwichName")), "number"]], diff --git a/views/orders.pug b/views/commands.pug similarity index 94% rename from views/orders.pug rename to views/commands.pug index facee85..bbcdade 100644 --- a/views/orders.pug +++ b/views/commands.pug @@ -19,4 +19,4 @@ block content div.sandwich h4= sandwich.Sandwich.name - script(src="javascripts/orders.js") + script(src="javascripts/commands.js") diff --git a/views/layout.pug b/views/layout.pug index b248e5e..50028e1 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -14,7 +14,7 @@ html a(href="/sandwiches") Sandwiches if user.permissions >= 2 p - - a(href="/orders") Commands + a(href="/commands") Commands if user.permissions >= 3 p - a(href="/admin") Administration