开发者

Customizing Number of Page Links Rendered With will_paginate?

开发者 https://www.devze.com 2022-12-26 17:31 出处:网络
I\'m using the will_paginate gem for my Rails project and it\'s working beautifully.Unfortunately, on paginated result sets with a larger number of pages, the link section is too wide.Instead of:

I'm using the will_paginate gem for my Rails project and it's working beautifully. Unfortunately, on paginated result sets with a larger number of pages, the link section is too wide. Instead of:

« Previous 1 2 … 5 6 7 8 9 10 11 12 13 … 18 19 Next »

I would like to show:

« Previous 1 2 … 5 6 7 8 9 … 18 19 开发者_StackOverflow中文版Next »

How can I reduce the number of page links being rendered? I looked at the will_paginate docs on github but couldn't find a solution.

Thanks! Moe


Use the :inner_window option:

<%= will_paginate stuff, :inner_window => 2 %>

You can see all the options right here.

0

精彩评论

暂无评论...
验证码 换一张
取 消