From fd7bbbbd45f1af8cf4dc358ed3cf3d9e1dd4f1d1 Mon Sep 17 00:00:00 2001 From: fabcodingzest <48706652+fabcodingzest@users.noreply.github.com> Date: Thu, 13 Aug 2020 19:32:56 +0530 Subject: [PATCH] Made the Nav again and enhanced other comp. #33 --- routes/api/cart.js | 2 +- routes/api/market.js | 4 +- routes/api/portfolio.js | 2 +- views/layouts/app.ejs | 2 +- views/market.ejs | 2 +- views/partials/_nav.ejs | 198 ++++++++++------------------------------ views/portfolio.ejs | 2 +- 7 files changed, 54 insertions(+), 158 deletions(-) diff --git a/routes/api/cart.js b/routes/api/cart.js index 1791e02..b2cde8a 100644 --- a/routes/api/cart.js +++ b/routes/api/cart.js @@ -17,7 +17,7 @@ const getPrice = require("../../helpers/getPrice"); router.get("/:symbol", ensureAuth, async (req, res) => { const symbol = req.params.symbol; const price = await getPrice(symbol); - res.status(200).render("cart", { layout: "layouts/app", symbol, price }); + res.status(200).render("cart", { layout: "layouts/app", symbol, price, href: '/market' }); }); // @desc To buy diff --git a/routes/api/market.js b/routes/api/market.js index cb2e011..a59308d 100644 --- a/routes/api/market.js +++ b/routes/api/market.js @@ -15,7 +15,7 @@ const { ensureAuth, ensureGuest } = require("../../middleware/auth"); // @route GET /Market // @access Private router.get("/", ensureAuth, async (req, res) => { - res.status(200).render("market", { layout: "layouts/app", jsonData }); + res.status(200).render("market", { layout: "layouts/app", jsonData, href: '/market' }); }); - + module.exports = router; diff --git a/routes/api/portfolio.js b/routes/api/portfolio.js index fe03bee..8aaaab7 100644 --- a/routes/api/portfolio.js +++ b/routes/api/portfolio.js @@ -9,7 +9,7 @@ const { ensureAuth, ensureGuest } = require("../../middleware/auth"); // @access Private router.get("/", ensureAuth, (req, res) => { let avatar = req.user.image; - res.status(200).render("portfolio", { layout: "layouts/app", avatar }); + res.status(200).render("portfolio", { layout: "layouts/app", avatar, href: '/portfolio' }); }); module.exports = router; diff --git a/views/layouts/app.ejs b/views/layouts/app.ejs index 0167166..730530a 100644 --- a/views/layouts/app.ejs +++ b/views/layouts/app.ejs @@ -19,7 +19,7 @@ -
+
<%- include('../partials/_nav.ejs') %> <%- body %>
diff --git a/views/market.ejs b/views/market.ejs index 2fe0e6d..5b8e1e4 100644 --- a/views/market.ejs +++ b/views/market.ejs @@ -1,4 +1,4 @@ -
+
<% for(var i=0; i < jsonData.length; i++) { %> diff --git a/views/partials/_nav.ejs b/views/partials/_nav.ejs index 88a349f..d297ee6 100644 --- a/views/partials/_nav.ejs +++ b/views/partials/_nav.ejs @@ -1,156 +1,52 @@ -
- - -