Question

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?

Was it helpful?

Solution

Foundation was added in a recent release, so now you can do this:

rails g kaminari:views foundation

OTHER TIPS

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

Just to update this, I have the latest version of kaminari (0.16.1) and it includes a theme for foundation. Works great out of the box!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top