summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Marçalo <raroma09@gmail.com>2022-10-26 15:06:40 +0100
committerRafael Marçalo <raroma09@gmail.com>2022-10-26 15:06:40 +0100
commit1d0c0046a434dd3171b3d22818204fcf9daf1413 (patch)
treecc572b36103eecfede0c38613a55dd07c1aa5bb4
parent5dba81f9173fa96edb53645a5a2081e9408de69e (diff)
Added search bar to some of the views
-rw-r--r--routes/home.js2
-rw-r--r--routes/info.js2
-rw-r--r--routes/search.js2
-rw-r--r--routes/visit.js2
-rw-r--r--views/partials/top/navbar.ejs13
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 @@
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
</svg>
</a>
+
+ <% if (showSearchBar) { %>
+ <form class="d-flex" action="search" method="POST">
+ <div class="input-group">
+ <input type="text" class="form-control" placeholder="Search for torrent" name="search">
+ <button class="input-group-text btn btn-outline-success" type="submit">
+ <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
+ <path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"></path>
+ </svg>
+ </button>
+ </div>
+ </form>
+ <% } %>
</div>
</div>
</nav>