-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(storefront): BCTHEME-304 add pagination for wishlists
- Loading branch information
1 parent
4d4f9f2
commit 2fe3a5c
Showing
4 changed files
with
31 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const changeWishlistPaginationLinks = (wishlistUrl, ...paginationItems) => $.each(paginationItems, (_, $item) => { | ||
const paginationLink = $item.children('a'); | ||
|
||
if ($item.length && !paginationLink.attr('href').includes('page=')) { | ||
const pageNumber = paginationLink.attr('href'); | ||
paginationLink.attr('href', `${wishlistUrl}page=${pageNumber}`); | ||
} | ||
}); | ||
|
||
/** | ||
* helps to withdraw differences in structures around the stencil resource pagination | ||
*/ | ||
export const wishlistPaginatorHelper = () => { | ||
const $paginationList = $('.pagination-list'); | ||
|
||
if (!$paginationList.length) return; | ||
|
||
const $nextItem = $('.pagination-item--next', $paginationList); | ||
const $prevItem = $('.pagination-item--previous', $paginationList); | ||
const currentHref = $('.pagination-item--current', $paginationList).children('a').attr('href'); | ||
const partialPaginationUrl = currentHref.split('page=').shift(); | ||
|
||
changeWishlistPaginationLinks(partialPaginationUrl, $prevItem, $nextItem); | ||
}; |
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 |
---|---|---|
|
@@ -11,3 +11,4 @@ | |
</li> | ||
{{/each}} | ||
</ul> | ||
{{> components/common/paginator wishlist.pagination}} |