Ruby on rails 分页无法正常工作-将分页,引导4
我是新手。尝试在我的项目中添加will_paginate,按照说明添加相应的配置。最后,它工作并显示页码 1.)问题在于,当显示页码和下一页选项时,数字之间没有空格 2.)是否有任何方法使用will_paginate bootstrap和bootstrap 4?据我所知,那个家伙提到他不再为那颗宝石提供支持了 有没有办法使用will_paginate bootstrap和bootstrap 4?据我所知,那个家伙提到他不再为那颗宝石提供支持了Ruby on rails 分页无法正常工作-将分页,引导4,ruby-on-rails,twitter-bootstrap,bootstrap-4,will-paginate,Ruby On Rails,Twitter Bootstrap,Bootstrap 4,Will Paginate,我是新手。尝试在我的项目中添加will_paginate,按照说明添加相应的配置。最后,它工作并显示页码 1.)问题在于,当显示页码和下一页选项时,数字之间没有空格 2.)是否有任何方法使用will_paginate bootstrap和bootstrap 4?据我所知,那个家伙提到他不再为那颗宝石提供支持了 有没有办法使用will_paginate bootstrap和bootstrap 4?据我所知,那个家伙提到他不再为那颗宝石提供支持了 以下是将_paginate支持bootstrap
以下是
将_paginate
支持bootstrap4
您遇到的问题与Ruby/Rails完全无关:它只是一个CSS问题。will_paginate对分页部分的样式不做任何假设,只输出未设置样式的HTML标记。然后,你有责任根据自己的喜好来设计它——例如,正如你所提到的,使用Bootstrap
一般来说,我建议使用而不是will_paginate:我认为分页解决方案使用常规模板而不是使用helper方法呈现所有HTML更有意义。但这只是我的观点,在使用will_paginate十多年后,Kaminari几乎在6年半前问世。因为你可以看到数字,你的引导程序4似乎已经在工作了,你只需要制作CSS样式,使那些分页链接更漂亮,这是来源 要自定义其查看方式,请参见下面的示例或将对scss文件进行分页 您可以在app/stylesheets/will_paginate.scss中创建一个scss文件,并将代码放在下面
.digg_pagination {
background: #FFFFFF;
font-size: 1.2em;
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;
}
我想这就是你要找的,我用过它,但不知道它是否支持Bootstrap4,我试过了,但不起作用。这家伙写了一个大纸条:他停止了对bootstrap的支持。我从来没有使用过paginate bootstrap gem,我只是按照这里的建议做了,它对我很好。。。事实上,你应该在你的项目中自动添加css。但由于对bootsrap4的支持被那个gem丢失了,这就是问题所在。但现在我发现了一个支持新引导的新gem。但是谢谢