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() {
console.log('Document is ready!');
$('#filter-limiter').on('change', () => {
$('#filter-limit').on('change', () => {
$('#filter-form').submit();
});
});

View File

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

View File

@ -85,13 +85,13 @@
<section class="row">
<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">
<option value="5">5</option>
<option value="10">10</option>
<option value="20">20</option>
<option value="35">35</option>
<option value="50">50</option>
<option {% if filters['limit'] == 5 %}selected{% endif %} value="5">5</option>
<option {% if filters['limit'] == 10 %}selected{% endif %} value="10">10</option>
<option {% if filters['limit'] == 20 %}selected{% endif %} value="20">20</option>
<option {% if filters['limit'] == 35 %}selected{% endif %} value="35">35</option>
<option {% if filters['limit'] == 50 %}selected{% endif %} value="50">50</option>
</select>
</form>
</div>