From 1d0c0046a434dd3171b3d22818204fcf9daf1413 Mon Sep 17 00:00:00 2001 From: Rafael Marçalo Date: Wed, 26 Oct 2022 15:06:40 +0100 Subject: Added search bar to some of the views --- routes/home.js | 2 +- routes/info.js | 2 +- routes/search.js | 2 +- routes/visit.js | 2 +- views/partials/top/navbar.ejs | 13 +++++++++++++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/routes/home.js b/routes/home.js index c98599e..57d5722 100644 --- a/routes/home.js +++ b/routes/home.js @@ -2,7 +2,7 @@ function home(req, res) { - res.render('index'); + res.render('index', {showSearchBar: false}); }; module.exports = home; diff --git a/routes/info.js b/routes/info.js index 820b674..2b0687a 100644 --- a/routes/info.js +++ b/routes/info.js @@ -2,7 +2,7 @@ function info(req, res) { - res.render('info'); + res.render('info', {showSearchBar: true}); }; module.exports = info; diff --git a/routes/search.js b/routes/search.js index e87a790..e7a1b41 100644 --- a/routes/search.js +++ b/routes/search.js @@ -7,7 +7,7 @@ async function search(req, res) { let query = req.body.search; let results = await apibay.hit(query); - res.render('result', {query: query, results: results, functions: template}); + res.render('result', {query: query, results: results, functions: template, showSearchBar: true}); }; module.exports = search; diff --git a/routes/visit.js b/routes/visit.js index 11a3c23..9cf34ba 100644 --- a/routes/visit.js +++ b/routes/visit.js @@ -2,7 +2,7 @@ function visit(req, res) { - res.render('visit'); + res.render('visit', {showSearchBar: true}); }; module.exports = visit; diff --git a/views/partials/top/navbar.ejs b/views/partials/top/navbar.ejs index 3e003a4..d9c06db 100644 --- a/views/partials/top/navbar.ejs +++ b/views/partials/top/navbar.ejs @@ -11,6 +11,19 @@ + + <% if (showSearchBar) { %> +
+
+ + +
+
+ <% } %> -- cgit v1.2.3