Ruby 宝石 Will_Paginate 造型

Ruby gems Will_Paginate styling

在 rails 应用程序上使用 Will_paginate gem 作为 ruby,但我没有使用 Bootstrap。如何设置页面按钮的样式?我在这里不知所措。想想也许 will_paginate @posts 可以吗?或者什么 o.o 和样式,我说的是 CSS 以防万一。

你可以使用这个 css(没有 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; 
}

并在你的 erb 中添加 css class 就像下面的示例

<% if @news.any? %>
  <%= render @news %>
  <div class="digg_pagination">
    <%= will_paginate %>
  </div>
<% end %>

这是最简单的解决方案https://github.com/delef/will_paginate-bootstrap4

添加到您的 Gemfile:

gem 'will_paginate-bootstrap4'

用法

<%= will_paginate @clients, renderer: WillPaginate::ActionView::BootstrapLinkRenderer %>

给你