How to use kaminari theme for zurb foundation
Asked Answered
T

5

7

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?

Thrasonical answered 24/1, 2014 at 13:6 Comment(0)
B
18

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

rails g kaminari:views foundation
Bloodyminded answered 15/10, 2014 at 14:57 Comment(0)
N
2

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!

Neutralization answered 15/2, 2014 at 19:8 Comment(0)
S
1

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!

Sacellum answered 24/1, 2014 at 13:43 Comment(0)
C
1

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

Centriole answered 3/6, 2014 at 11:57 Comment(0)
T
0

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!

Trachyte answered 26/9, 2014 at 1:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.