mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
created testing for activity page
This commit is contained in:
@@ -34,17 +34,10 @@ def generate_previous_next_dict(view, service_id, page, title, url_args):
|
||||
def generate_pagination_pages(total_items, page_size, current_page):
|
||||
total_pages = (total_items + page_size - 1) // page_size
|
||||
pagination = {"current": current_page, "pages": [], "last": total_pages}
|
||||
if total_pages <= 4:
|
||||
if total_pages <= 9:
|
||||
pagination["pages"] = list(range(1, total_pages + 1))
|
||||
else:
|
||||
if current_page <= 3:
|
||||
pagination["pages"] = [1, 2, 3, total_pages]
|
||||
else:
|
||||
pagination["pages"] = [
|
||||
1,
|
||||
current_page - 1,
|
||||
current_page,
|
||||
current_page + 1,
|
||||
total_pages,
|
||||
]
|
||||
start_page = max(1, min(current_page - 4, total_pages - 8))
|
||||
end_page = min(start_page + 8, total_pages)
|
||||
pagination["pages"] = list(range(start_page, end_page + 1))
|
||||
return pagination
|
||||
|
||||
Reference in New Issue
Block a user