Skip to content

Commit

Permalink
put page numbers in page labels for extracted files
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Nov 13, 2024
1 parent 79958a1 commit 9e142a6
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions shared/bin/extracted_files_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,26 @@ def do_GET(self):
eprint(f'Error with file "{filename}": {e}')

# pagination controls
with div(cls='pagination'):
br()
with div(
cls='pagination',
style='text-align: center; display: flex; justify-content: center; padding: 0;',
):
with ul(
cls='pagination-list',
style='display: flex; list-style: none; justify-content: center; padding: 0;',
):
# previous page link
if page > 1:
prevPageUrl = f'?page={page - 1}&elements={elements}'
li(a('Previous', href=prevPageUrl, cls='page-link'), cls='page-item')
li(
a(
f'Previous ({page - 1})',
href=prevPageUrl,
cls='page-link',
),
cls='page-item',
)
else:
li(span('Previous', cls='page-link disabled'), cls='page-item')

Expand All @@ -345,7 +356,10 @@ def do_GET(self):
# next page link
if page < totalPages:
nextPageUrl = f'?page={page + 1}&elements={elements}'
li(a('Next', href=nextPageUrl, cls='page-link'), cls='page-item')
li(
a(f'Next ({page + 1} of {totalPages})', href=nextPageUrl, cls='page-link'),
cls='page-item',
)
else:
li(span('Next', cls='page-link disabled'), cls='page-item')

Expand Down

0 comments on commit 9e142a6

Please sign in to comment.