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
Remove duplicated pagination class for Bootstrap #212
Remove duplicated pagination class for Bootstrap #212
Conversation
Codecov Report
@@ Coverage Diff @@
## master #212 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 26 26
Lines 530 530
=====================================
Hits 530 530
Continue to review full report at Codecov.
|
Thank you for the explanation and the PR. |
I’m happy to do it, @ddnexus — thanks for answering! I’ll get to in next week and ping you back. 🏁 |
@gnclmorais Any update? |
The `.pagination` class at Bootstrap adds margin at the top and at the bottom of the element it is on. Looking at the [current examples][0] they have on their documentation page, only one element has this class and it’s an inner one, not the parent `<nav>`. While working on one of our projects, I noticed that Pagy had way more vertical margins than it should have, so I noticed its Bootstrap helper was adding the class twice on two different elements. Since I believe the markup it outputs should be as close as possible to Bootstrap’s documentation, the class added to the `<nav>` element feels out of place. [0]: https://getbootstrap.com/docs/4.4/components/pagination/#overview
Hey @ddnexus, sorry for the delay. 😅 I’ve removed the |
Thank you @gnclmorais. I will review and merge it ASAP. |
Fun fact, the extra def pagy_nav(pagy)
link, p_prev, p_next = pagy_link_proc(pagy), pagy.prev, pagy.next
html = EMPTY + (p_prev ? %(<li>#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</li> )
: %(<li class="disabled"><a href="#">#{pagy_t('pagy.nav.prev')}</a></li> ))
pagy.series.each do |item|
html << if item.is_a?(Integer); %(<li>#{link.call item}</li> )
elsif item.is_a?(String) ; %(<li class="active"><a href="#">#{item}</a></li> )
elsif item == :gap ; %(<li class="disabled"><a href="#">#{pagy_t('pagy.nav.gap')}</a></li> )
end
end
html << (p_next ? %(<li>#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</li>)
: %(<li class="disabled"><a href="#">#{pagy_t('pagy.nav.next')}</a></li>))
%(<div class="pagination" role="navigation" aria-label="pager"><ul>#{html}</ul></div>)
end |
Now that you mention it, I remember why I put it there! |
The
.pagination
class at Bootstrap adds margin at the top and at the bottom of the element it is on. Looking at the current examples they have on their documentation page, only one element has this class and it’s an inner one, not the parent<nav>
.While working on one of our projects, I noticed that Pagy had way more vertical margins than it should have, so I noticed its Bootstrap helper was adding the class twice on two different elements. Since I believe the markup it outputs should be as close as possible to Bootstrap’s documentation, the class added to the
<nav>
element feels out of place.