I want to apply a theme for zurb foundation to kaminari
pagination.
Detault theme can be installed by rails g kaminari:views default
.
But I couldn't figure out how to install other themes.
Especially, theme for foundation is not merged. https://github.com/amatsuda/kaminari_themes/pull/14
There is no readme in kaminari_themes, so I have no idea how to go further. What should I do to apply the foundation theme?
Foundation was added in a recent release, so now you can do this:
rails g kaminari:views foundation
If you generate the theme (it might not matter which one), for example
rails g kaminari:views bootstrap
You can see all of the "machinery" in the views\kaminari\
folder. Here is my "hack" to get Foundations Pagination working with Kaminari:
I tweaked _paginator.html.haml
to reflect the Foundation class on the ul
tag:
= paginator.render do
%ul.pagination
...
And I tweaked _page.html.haml
to reflect Foundations current
class (instead of Kaminari's active
:
%li{class: "#{'current' if page.current?}"}
And then it just worked!
I tried this command and it worked: rails g kaminari:views bootstrap
. The source, here, makes it clear that he's pulling themes from his themes repo when running rails g kaminari:views
. Pretty cool!
A not so hacky solution would be to use theme from RalphAtHamburg's fork.
Simply copy kaminari views to app/views/kaminari/
directory.
This is similar to what happens when you run rails g kaminari:views [default|bootstrap|google|github]
, If these partials are present in app/views/kaminari/
Kaminari uses them instead of the default partial views.
For more info on themes use Kaminari Readme
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With