简体   繁体   English

Rails 3:你如何设计will_paginate链接?

[英]Rails 3: How do you style will_paginate links?

In coding layout is the link styled like 在编码布局中,链接的样式就像

<a href="#" class="class1 class2 class3"><span>Previous</span></a>
<a href="#" class="class1 class2 class3"><span>Next</span>

I tried to search and I found some possible modifications of a shape of these two links. 我试图搜索,我发现这两个链接的形状可能有一些修改。 It's: 它的:

<div class="pag">
  <%= will_paginate @data, :page_links => false, :next_label => '' %> 
</div>

<div class="pag">
  <%= will_paginate @data, :page_links => false, :previous_label => '' %>
</div>

My question: How can I update the second example to the shape of the first example? 我的问题:如何将第二个示例更新为第一个示例的形状? My problem is those two span elements... 我的问题是那两个span元素......

Thanks 谢谢

It's can be very easy - just add html markup for your paginate components to your config/locales/en.yml file for example: 它可以非常简单 - 只需将您的paginate组件的html标记添加到config / locales / en.yml文件中,例如:

en:
  hello: "Hello world"
  will_paginate:
    previous_label: <span class="glyph glyph-prev"></span>
    next_label: <span class="glyph glyph-next"></span>

It's all! 这就是全部!

http://thewebfellas.com/blog/2010/8/22/revisited-roll-your-own-pagination-links-with-will_paginate-and-rails-3您可以拥有自己的格式化程序,以便自定义任何您想要的内容。

Wiki 维基

en:
  will_paginate:
    previous_label: "&#8592; Previous"
    next_label: "Next &#8594;"
    page_gap: "&hellip;"

https://github.com/mislav/will_paginate/wiki/I18n#translating-will_paginate-output https://github.com/mislav/will_paginate/wiki/I18n#translating-will_paginate-output

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM