开发者

will_paginate 2.3.15 - creating unique id selector for each page link

Using the will_paginate gem, I want to create output that looks like this for the <a> tags:

<div class="navPagination"开发者_如何学Go>
  <span class="disabled prev_page">Prev</span>
  <span class="current">1</span>
  <a id="pag-top-2" rel="next" href="/aba/2011/07/30?page=2">2</a>
  <a id="pag-top-Next" class="next_page" rel="next" href="/aba/2011/07/30?page=2">Next</a>
</div>

Notice that both the <a> tags have a unique id selector. How can I create unique selector id's for each will_paginate page?

Note: if this isn't enough info, let me know and I'll try to provide more context.


Here is a very detailled article about customizing will_paginate's output writing your own renderer.


Maybe you can fork will_paginate and change this line:

https://github.com/mislav/will_paginate/blob/v2.3.15/lib/will_paginate/view_helpers.rb#L307

for this code:

page_span page, text, :class => span_class, :id => "pag-top-#{text}"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜