Rails 使用 will_paginate 渲染 ul li 列表
我在我的 Rails 应用程序中使用 will_paginate,它工作正常,但我想使用 ul li list 作为我的网页设计器布局。实际上,用我的代码,它只是渲染
我的视图:
<div class="pagination">
<ul><li><%= will_paginate @organizations %></li></ul>
</div>
我的源代码:
<ul><li><div class="pagination">
<span class="previous_page disabled">← Previous</span>
<em>1</em>
<a rel="next" href="/organizations?page=2&search=2&submit_search=ok">2</a>
<a href="/organizations?page=3&search=2&submit_search=ok">3</a>
<a class="next_page" rel="next" href="/organizations?page=2&search=2&submit_search=ok">Next →</a>
</div></ul>/<li>
我想得到这种结果:
<div class="pagination">
<ul>
<li class="prev"><a href="#"><span>Prev</span></a></li>
<li><a href="#"><span>1</span></a></li>
<li><a href="#"><span>2</span></a></li>
<li><a href="#"><span>3</span></a></li>
<li class="next"><a href="#"><span>Next</span></a></li>
</ul>
</div>
如何才能做到?
I'm using will_paginate in my rails application, it's working fine but I would like to use ul li list for my webdesigner layout. Actually with my code, it's only rendering
my view :
<div class="pagination">
<ul><li><%= will_paginate @organizations %></li></ul>
</div>
My source code:
<ul><li><div class="pagination">
<span class="previous_page disabled">← Previous</span>
<em>1</em>
<a rel="next" href="/organizations?page=2&search=2&submit_search=ok">2</a>
<a href="/organizations?page=3&search=2&submit_search=ok">3</a>
<a class="next_page" rel="next" href="/organizations?page=2&search=2&submit_search=ok">Next →</a>
</div></ul>/<li>
I would like to have this kind of result :
<div class="pagination">
<ul>
<li class="prev"><a href="#"><span>Prev</span></a></li>
<li><a href="#"><span>1</span></a></li>
<li><a href="#"><span>2</span></a></li>
<li><a href="#"><span>3</span></a></li>
<li class="next"><a href="#"><span>Next</span></a></li>
</ul>
</div>
How can it be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
will_paginate 文档链接到示例< /a> 这与您在这里要求的几乎相同。
向下滚动到“按照你的方式做”。
The will_paginate docs link to an example that is nearly identical to what you're asking for here.
Scroll down to "Doing it Your Way."