Add admin to routes
This commit is contained in:
parent
43851413ea
commit
ffe31c6af9
5 changed files with 48 additions and 5 deletions
2
app.js
2
app.js
|
@ -11,6 +11,7 @@ let logoutRouter = require("./routes/logout");
|
|||
let commandRouter = require("./routes/command");
|
||||
let ordersRouter = require("./routes/orders");
|
||||
let sandwichesRouter = require("./routes/sandwiches");
|
||||
let adminRouter = require("./routes/admin");
|
||||
|
||||
let app = express();
|
||||
let sess = {
|
||||
|
@ -40,6 +41,7 @@ app.use("/logout", logoutRouter);
|
|||
app.use("/command", commandRouter);
|
||||
app.use("/orders", ordersRouter);
|
||||
app.use("/sandwiches", sandwichesRouter);
|
||||
app.use("/admin", adminRouter);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use((req, res) => {
|
||||
|
|
|
@ -27,7 +27,7 @@ body {
|
|||
box-shadow: 0.5em 0.5em 0.5em rgba(0, 0, 255, .2);
|
||||
}
|
||||
|
||||
h1, h2, p, label {
|
||||
h1, h2, h3, p, label {
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -56,7 +56,8 @@ a {
|
|||
font-size: 100%;
|
||||
}
|
||||
|
||||
.field input[type="text"], .field input[type="list"], .field input[type="date"] {
|
||||
.field input[type="text"], .field input[type="list"], .field input[type="date"], .field input[type="number"],
|
||||
.field input[type="checkbox"] {
|
||||
height: 2.5vh;
|
||||
border-top: none;
|
||||
border-left: none;
|
||||
|
@ -101,7 +102,7 @@ a {
|
|||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#about, #contact {
|
||||
.popup {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
@ -159,6 +160,11 @@ p.before-link a::before {
|
|||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
@media (hover: none) and (pointer: coarse) {
|
||||
body {
|
||||
font-size: xx-large;
|
||||
|
|
11
routes/admin.js
Normal file
11
routes/admin.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
let express = require("express");
|
||||
let router = express.Router();
|
||||
let sessionCheck = require("../middlewares/sessionCheck");
|
||||
let models = require("../models");
|
||||
|
||||
|
||||
router.get("/", sessionCheck(3), async (req, res) => {
|
||||
res.render("admin", {title: "SOD", sandwiches: await models.Sandwich.findAll(), users: await models.User.findAll()});
|
||||
});
|
||||
|
||||
module.exports = router;
|
24
views/admin.pug
Normal file
24
views/admin.pug
Normal file
|
@ -0,0 +1,24 @@
|
|||
extends layout
|
||||
|
||||
block content
|
||||
div.card
|
||||
h1 Administration
|
||||
div
|
||||
h2 Order management
|
||||
div.buttons
|
||||
a(href="/admin/orders/date")
|
||||
button Orders date
|
||||
a(href="/admin/order")
|
||||
button Manage orders
|
||||
|
||||
div
|
||||
h2 Sandwich management
|
||||
div.buttons
|
||||
a(href="/admin/sandwiches")
|
||||
button Manage sandwiches
|
||||
|
||||
div
|
||||
h2 User management
|
||||
div.buttons
|
||||
a(href="/admin/users")
|
||||
button Manage users
|
|
@ -44,7 +44,7 @@ block content
|
|||
a Contact
|
||||
|
||||
div#dark.hide
|
||||
div#about.card.hide
|
||||
div#about.popup.card.hide
|
||||
h1 About
|
||||
p This software respond to the COVID-19 health crisis for the following students' offices food supply
|
||||
div.images
|
||||
|
@ -68,7 +68,7 @@ block content
|
|||
p IT student office
|
||||
p.before-link Made with ❤️ by
|
||||
a(href="https://www.linkedin.com/in/florian-charlaix" target="_blank") Florian Charlaix
|
||||
div#contact.card.hide
|
||||
div#contact.popup.card.hide
|
||||
h1 Contact
|
||||
p.before-link Order issue:
|
||||
a(href="mailto: ") test@test.fr
|
||||
|
|
Reference in a new issue