diff --git a/assets/js/nechryael.js b/assets/js/nechryael.js index 33a8a21..847577c 100644 --- a/assets/js/nechryael.js +++ b/assets/js/nechryael.js @@ -1,3 +1,7 @@ $(document).ready(function() { console.log('Document is ready!'); + + $('#filter-limiter').on('change', () => { + $('#filter-form').submit(); + }); }); diff --git a/src/routes/home.js b/src/routes/home.js index b3a22a1..ad4bb3c 100644 --- a/src/routes/home.js +++ b/src/routes/home.js @@ -4,9 +4,16 @@ 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; + } + // fetch inventory items from database const items = await Item.findAll({ - limit: 10, + limit: limit, order: [ ['updatedAt', 'DESC'], ], @@ -14,7 +21,7 @@ exports.getIndex = async function(req, res) { // fetch licenses from database const licenses = await License.findAll({ - limit: 10, + limit: limit, order: [ ['updatedAt', 'DESC'], ], diff --git a/views/index.twig b/views/index.twig index 2604197..07cb6a9 100644 --- a/views/index.twig +++ b/views/index.twig @@ -83,4 +83,18 @@ +
+
+
+ +
+
+
+ {% endblock %}