Sha256: 0ad60b6ac4407c30d04c80060f70eb2416bc4eaad8dc96d960a13e9e87af6485

Contents?: true

Size: 794 Bytes

Versions: 31

Compression:

Stored size: 794 Bytes

Contents

# Custom pagination renderer
# Call using will_paginate(@results, :renderer => 'PrevNextLinks')
class PrevNextLinks < WillPaginate::LinkRenderer
  
  def to_html
    links = []
    links << page_link_or_span(@collection.previous_page, 'disabled prev_page', @options[:previous_label])
    if @collection.size < 1
      links << "<b>0&nbsp;-&nbsp;0</b> of <b>0</b>"
    else
      links << %{<b>%d&nbsp;-&nbsp;%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', @options[:next_label])
    html = links.join(@options[:separator])
    @options[:container] ? @template.content_tag(:div, html, html_attributes) : html
  end
  
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
hydra-head-3.1.0.rc1 lib/prev_next_links.rb
hydra-head-3.1.0.pre5 lib/prev_next_links.rb
hydra-head-3.1.0.pre4 lib/prev_next_links.rb
hydra-head-3.1.0.pre3 lib/prev_next_links.rb
hydra-head-3.0.1 lib/prev_next_links.rb
hydra-head-3.1.0.pre2 lib/prev_next_links.rb
hydra-head-3.0.0 lib/prev_next_links.rb
hydra-head-3.1.0.pre1 lib/prev_next_links.rb
hydra-head-3.0.0.rc2 lib/prev_next_links.rb
hydra-head-3.0.0.rc1 lib/prev_next_links.rb
hydra-head-3.0.0pre4 lib/prev_next_links.rb