diff --git a/public/js/vroom.js b/public/js/vroom.js index 6ff7b6d..5f3da9c 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -36,9 +36,6 @@ $('.date-picker').datepicker({ language: currentLang }); -// When pagination is done, how many item per page -var itemPerPage = 20; - // Regex to check a date var dateRe = /^\d{4}\-\d{1,2}\-\d{1,2}$/; @@ -579,6 +576,7 @@ function initDoc(){ function initAdminRooms(){ var roomList = {}; var matches = 0; + var itemPerPage = $('#item-per-page').val(); // Update display of room list function updateRoomList(filter, min, max){ @@ -697,6 +695,13 @@ function initAdminRooms(){ ); } + // Update pagination + $('#item-per-page').change(function(){ + itemPerPage = $('#item-per-page').val(); + updateEventList($('#searchRoom').val(), 0, itemPerPage); + updatePagination(); + }); + // Handle submiting the configuration form $(document).on('click', '.btn-configure', function(){ roomName = $(this).data('room'); @@ -744,6 +749,7 @@ function initAdminRooms(){ function initAdminAudit(){ var eventList = {}; var matches = 0; + var itemPerPage = $('#item-per-page').val(); // Update display of event list function updateEventList(filter, min, max){ @@ -815,6 +821,13 @@ function initAdminAudit(){ ); } + // Update pagination + $('#item-per-page').change(function(){ + itemPerPage = $('#item-per-page').val(); + updateEventList($('#searchEvent').val(), 0, itemPerPage); + updatePagination(); + }); + // When we click on either refresh or export buttons, check dates are valid $('#events_refresh,#events_export').click(function(e){ e.preventDefault(); diff --git a/templates/default/admin_audit.html.ep b/templates/default/admin_audit.html.ep index d0407f7..6f9e387 100644 --- a/templates/default/admin_audit.html.ep +++ b/templates/default/admin_audit.html.ep @@ -54,6 +54,20 @@ % } +