Merge pull request #2438 from overleaf/jel-gallery-pagination

Gallery pagination

GitOrigin-RevId: 0592f60bcc094360bd3d5eddd9251630a4a892b6
This commit is contained in:
Jessica Lawshe 2019-12-09 09:09:09 -06:00 committed by Copybot
parent 05800f0143
commit 609fe21402

View file

@ -1,4 +1,4 @@
mixin paginate(pages, page_path, max_btns) mixin pagination(pages, page_path, max_btns)
//- @param pages.current_page the current page viewed //- @param pages.current_page the current page viewed
//- @param pages.total_pages previously calculated, //- @param pages.total_pages previously calculated,
//- based on total entries and entries per page //- based on total entries and entries per page
@ -6,7 +6,7 @@ mixin paginate(pages, page_path, max_btns)
//- @param max_btns max number of buttons on either side of the current page //- @param max_btns max number of buttons on either side of the current page
//- button and excludes first, prev, next, last //- button and excludes first, prev, next, last
if pages && pages.current_page && pages.total_pages if pages && pages.current_page && pages.total_pages && pages.total_pages > 1
- var max_btns = max_btns || 4 - var max_btns = max_btns || 4
- var prev_page = Math.max(parseInt(pages.current_page, 10) - max_btns, 1) - var prev_page = Math.max(parseInt(pages.current_page, 10) - max_btns, 1)
- var next_page = parseInt(pages.current_page, 10) + 1 - var next_page = parseInt(pages.current_page, 10) + 1