You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default paginator has separate partials for the current page, the first page, and the last page. However, these are not mutually exclusive sets. To facilitate styling, the paginator should emit page spans with both the current and first/last classes when this is appropriate.
Perhaps there should just be one page partial: include "first" class if page.first?, include "last" class if page.last?, include "current" class if page.current?, and link the page number if not page.current?.
The text was updated successfully, but these errors were encountered:
Thank you for your opinion. Very good point as usual.
I understand what you mean. I know that Ruby/Rails can do that in a very simple way. In fact, my very first implementation was just a 40 lines of code like this amatsuda@bd2f1b5
and it was working almost the same with current version.
And since then, I've been trying to decouple the logic and view as far as possible, because I wanted to create something designers can understand. Then finally I came up with current style that does never use if or for - each or ternary operator or content_tag or any other Ruby code inside each minimum partial.
As a result... honestly, I'm not so much satisfied with current helper. Not only because a page can not be both current and first or last. I should admit that current "partialful" approach makes the generated code hard to understand for both programmers and designers.
So, I just implemented your proposal and pushed the code to a new branch. Perhaps the helper on this banch will be logically correct, and became a bit easier to deal with. https://github.com/amatsuda/kaminari/tree/issue_28
The default paginator has separate partials for the current page, the first page, and the last page. However, these are not mutually exclusive sets. To facilitate styling, the paginator should emit page spans with both the current and first/last classes when this is appropriate.
Perhaps there should just be one page partial: include "first" class if page.first?, include "last" class if page.last?, include "current" class if page.current?, and link the page number if not page.current?.
The text was updated successfully, but these errors were encountered: