Fixed search limiter
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Gregory Ballantine 2024-05-24 12:47:57 -04:00
parent d95be2e185
commit c652e089d5
3 changed files with 10 additions and 13 deletions

View File

@ -1,7 +1,5 @@
$(document).ready(function() { $(document).ready(function() {
console.log('Document is ready!'); $('#filter-limit').on('change', () => {
$('#filter-limiter').on('change', () => {
$('#filter-form').submit(); $('#filter-form').submit();
}); });
}); });

View File

@ -5,10 +5,9 @@ const License = db.licenses;
// GET - / // GET - /
exports.getIndex = async function(req, res) { exports.getIndex = async function(req, res) {
// check if there's a limit set // check if there's a limit set
if (isset(req.body['limit'])) { let limit = 10; // default to 10 results
const limit = req.body.limit; if ('limit' in req.query) {
} else { const limit = req.query.limit;
const limit = 10;
} }
// fetch inventory items from database // fetch inventory items from database

View File

@ -85,13 +85,13 @@
<section class="row"> <section class="row">
<div class="columns twelve"> <div class="columns twelve">
<form id="filter-form" class="u-full-width" action="/" method="post"> <form id="filter-form" class="u-full-width" action="/" method="GET">
<select id="filter-limit" name="limit"> <select id="filter-limit" name="limit">
<option value="5">5</option> <option {% if filters['limit'] == 5 %}selected{% endif %} value="5">5</option>
<option value="10">10</option> <option {% if filters['limit'] == 10 %}selected{% endif %} value="10">10</option>
<option value="20">20</option> <option {% if filters['limit'] == 20 %}selected{% endif %} value="20">20</option>
<option value="35">35</option> <option {% if filters['limit'] == 35 %}selected{% endif %} value="35">35</option>
<option value="50">50</option> <option {% if filters['limit'] == 50 %}selected{% endif %} value="50">50</option>
</select> </select>
</form> </form>
</div> </div>