-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.3] Hide empty paginators #15125
[5.3] Hide empty paginators #15125
Conversation
ea6b3f1
to
f525283
Compare
What is |
"Elements" is only passed by the length aware paginator. |
<!-- "Three Dots" Separator --> | ||
@if (is_string($element)) | ||
<li class="page-item disabled"><span class="page-link">{{ $element }}</span></li> | ||
@if (count($elements) > 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You just just ask the paginator how large it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
count($paginator)
5fae59b
to
2a3a723
Compare
Not sure why I made that more complicated than it needs to be. I've updated PR to just check for |
2a3a723
to
19b7506
Compare
19b7506
to
88fbc52
Compare
It still renders when there is only one page but there is more than one item to display, which is different from 5.2. |
Meh, that's ok I think. Kinda odd to hide in that case. |
Er so that's why I had the code as I did... I wasn't going mad! I think it should hide it imo, if there's only one page then no point displaying pagination. |
@GrahamCampbell I don't think it's ok to not render when there's only one item on the page, while still rendering when there are two items on the page. That's just plain inconsistent. |
I would prefer that it doesn't render the pagination links at all unless there is more than one page. Plus, it would make it consistent with 5.2. But if that's too much trouble, we should at least render the pagination links when there is only one item on the page as well:
|
Oh right I see what you mean. This code should be > 0 not > 1. Please PR. :) |
Oh, and I just realized there is another issue with the current code. Say you used have 26 items and you |
I think the code should be what I had it as before.... For the non simple paginators it should just be:
Then for the simple paginators it should be...
|
@garygreen Oh, I like that. And in fact, couldn't we use |
Reverted. Please send a correct PR. |
Fixes #15124