Pagination links in list mode
-
Mislav
- State changed from new to open
- Title changed from will_paginate enhancement to list mode enhancement
Hi, thanks for the suggestion/patch!
I've been planing to make a list mode for some time now, your code might help me to do it faster :)
-
Zohar Arad
Hey
Hope my code helps :)
Please let me know if there's anything else I can do regarding this.
Regards
Zohar
-
Mislav
- Title changed from list mode enhancement to [idea] list mode
- Assigned user changed from Chris Wanstrath to Mislav
-
Mislav
- Title changed from [idea] list mode to Pagination links in list mode
- State changed from open to resolved
- Tag changed from will_paginate to html, will_paginate
I've given this a lot of thought and resolved not to support list mode in core. I just don't see the semantic advantage, particularly when considering an unordered list.
Here is a drop-in link renderer that can do what you wanted. (This works on the "agnostic" branch of will_paginate, soon to be released.)
class ListRenderer < WillPaginate::ViewHelpers::LinkRenderer def to_html html = pagination.map do |item| item_html = item.is_a?(Fixnum) ? page_number(item) : send(item) tag(:li, item_html) end.join(@options[:separator]) @options[:container] ? html_container(html) : html end def html_container(html) tag(:ol, html, container_attributes) end end
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.