Class: PrevNextLinks
- Inherits:
-
WillPaginate::LinkRenderer
- Object
- WillPaginate::LinkRenderer
- PrevNextLinks
- Defined in:
- lib/prev_next_links.rb
Overview
Custom pagination renderer Call using will_paginate(@results, :renderer => ‘PrevNextLinks’)
Instance Method Summary (collapse)
Instance Method Details
- (Object) to_html
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/prev_next_links.rb', line 5 def to_html links = [] links << page_link_or_span(@collection.previous_page, 'disabled prev_page', [:previous_label]) if @collection.size < 1 links << "<b>0 - 0</b> of <b>0</b>" else links << %{<b>%d - %d</b> of <b>%d</b>} % [ @collection.start + 1, @collection.start + @collection.length, @collection.total ] end links << page_link_or_span(@collection.next_page, 'disabled next_page', [:next_label]) html = links.join([:separator]) [:container] ? @template.content_tag(:div, html, html_attributes) : html end |