-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Form - Limit and page fields * View/HTML/JS - Pagination object implementation * Search - order by FAC accepted date by default * Remove a print
- Loading branch information
Showing
5 changed files
with
151 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var FORM = document.forms[1]; | ||
const pagination_links = document.querySelectorAll('[aria-label^="Page"]'); | ||
const next_page_link = document.querySelectorAll('[aria-label="Next page"]'); | ||
const previous_page_link = document.querySelectorAll( | ||
'[aria-label="Previous page"]' | ||
); | ||
|
||
function attachEventHandlers() { | ||
// If any pagination links are clicked, set the form element and submit it for a reload | ||
pagination_links.forEach((link) => { | ||
link.addEventListener('click', (e) => { | ||
e.preventDefault(); | ||
FORM.elements['page'].value = link.textContent; | ||
FORM.submit(); | ||
}); | ||
}); | ||
// If the next or previous page buttons are clicked, set the form element to be +/- 1 and submit for a reload | ||
if (next_page_link[0]) { | ||
next_page_link[0].addEventListener('click', (e) => { | ||
e.preventDefault(); | ||
FORM.elements['page'].value = parseInt(FORM.elements['page'].value) + 1; | ||
FORM.submit(); | ||
}); | ||
} | ||
if (previous_page_link[0]) { | ||
previous_page_link[0].addEventListener('click', (e) => { | ||
e.preventDefault(); | ||
FORM.elements['page'].value = parseInt(FORM.elements['page'].value) - 1; | ||
FORM.submit(); | ||
}); | ||
} | ||
} | ||
|
||
function init() { | ||
attachEventHandlers(); | ||
} | ||
|
||
window.onload = init; |