Closed pouya314 closed 11 years ago
Ran into the same issue - then I realised how easy it is to generate view templates with kaminari.
First run this command: rails g kaminari:views bootstrap
Afterwards simply add all of the necessary CSS classes within "app/views/kaminari/_paginator.html.erb".
Obviously by this all of the gems out there that combine kaminari and bootstrap become obsolete ...
As a matter of fact, I came to use this gem because "rails g kaminari:views bootstrap" didn't work for me. I get the following error:
read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
Tried my luck through googling and stack overflow, but none of the solutions out there worked for me.
Can you help?
I don't have a concrete solution for your error message, sorry. But as I research from yesterday has shown kaminari connects to some different GitHub repository to download the views when you hit the generator. Obviously there's something wrong with the SSL certificate your server/system wants to communicate with when connecting to this external source.
But the evaluation of this error doesn't belong here, I guess.
To help you out and get you started with the Bootstrap templates, I uploaded them for you: I didn't customize the generated views beyond the pagination classes in "_paginator.html.erb" - so you will get mostly the standard Bootstrap layout.
There you go: https://dl.dropboxusercontent.com/u/13924138/130517_kaminari_bootstrap_template.tgz
Hope that helps!
Worked like a charm. Thank you so much for your help. My problem is now solved :-)
Just for quick reference for others wanting to use this option but also finding that :pagination_class
isn't actually implemented, here's a quick ready made _paginator.html.haml
partial you can use to override the Gem provided one (it's all you need).
= paginator.render do
-# Just add different Bootstrap pagination classes to .pagination below.
.pagination
%ul
= first_page_tag unless current_page.first?
= prev_page_tag unless current_page.first?
- each_page do |page|
- if page.left_outer? || page.right_outer? || page.inside_window?
= page_tag page
- elsif !page.was_truncated?
= gap_tag
= next_page_tag unless current_page.last?
= last_page_tag unless current_page.last?
Save the partial into app/views/kaminari/twitter-bootstrap/_paginator.html.haml
For quick reference the additional Bootstrap 2.x classes are:
.pagination-mini
.pagination-small
.pagination-large
.pagination-centered
.pagination-right
I have the following in my view: <%= paginate @posts, :theme => 'twitter-bootstrap', :pagination_class => "pagination-centered" %>
Theme is successfuly changed to twitter bootstrap but :pagination_class is not applied, i.e. my paginator is not centered.