Using the Will_paginate gem for a ruby on rails app, I'm not using Bootstrap though. How do I go about styling the page buttons? I'm at a loss here. Thinking maybe will_paginate @posts do? or what o.o and by styling, I'm talking about CSS in just in case.
Asked
Active
Viewed 3,302 times
6
-
May be [these examples](http://mislav.github.io/will_paginate/) help? I think it is not possible to edit their template(s) directly, instead you can modify the CSS as described in the link. – lxxxvi May 25 '20 at 07:50
-
Did you find a solution? On stackoverflow if you ask a question, there must be an answer – Yshmarov May 26 '20 at 15:11
-
Yes, this dude with the css below nailed it. Can change the colors and stuff so it worked perfectly. – CoderDude May 27 '20 at 23:12
2 Answers
7
you can use this css (without bootstrap)
.digg_pagination {
background: white;
cursor: default;
/* self-clearing method: */ }
.digg_pagination a, .digg_pagination span, .digg_pagination em {
padding: 0.2em 0.5em;
display: block;
float: left;
margin-right: 1px; }
.digg_pagination .disabled {
color: #999999;
border: 1px solid #dddddd; }
.digg_pagination .current {
font-style: normal;
font-weight: bold;
background: #2e6ab1;
color: white;
border: 1px solid #2e6ab1; }
.digg_pagination a {
text-decoration: none;
color: #105cb6;
border: 1px solid #9aafe5; }
.digg_pagination a:hover, .digg_pagination a:focus {
color: #000033;
border-color: #000033; }
.digg_pagination .page_info {
background: #2e6ab1;
color: white;
padding: 0.4em 0.6em;
width: 22em;
margin-bottom: 0.3em;
text-align: center; }
.digg_pagination .page_info b {
color: #000033;
background: #6aa6ed;
padding: 0.1em 0.25em; }
.digg_pagination:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden; }
* html .digg_pagination {
height: 1%; }
*:first-child + html .digg_pagination {
overflow: hidden;
}
and add css class this inside your erb like sample below
<% if @news.any? %>
<%= render @news %>
<div class="digg_pagination">
<%= will_paginate %>
</div>
<% end %>

widjajayd
- 6,090
- 4
- 30
- 41
4
Here's the most simple solution https://github.com/delef/will_paginate-bootstrap4
Add to your Gemfile:
gem 'will_paginate-bootstrap4'
Usage
<%= will_paginate @clients, renderer: WillPaginate::ActionView::BootstrapLinkRenderer %>
Gives you

Yshmarov
- 3,450
- 1
- 22
- 41