Sha256: ad83bd31d5db376607bbd654f0477a489eff5304cc73a7b9a8badf433ec646b1

Contents?: true

Size: 744 Bytes

Versions: 6

Compression:

Stored size: 744 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'will_paginate/view_helpers/link_renderer'

# Custom link renderer for WillPaginate
# Inserts commas into large page numbers
# example: 443719 becomes 443,719
#
# Note: To use this class, please call:
# <%= will_paginate(@users, :renderer => CommaLinkRenderer) %>

module Blacklight

  class CommaLinkRenderer < WillPaginate::ViewHelpers::LinkRenderer
    
    protected
    # Just overriding the page_number method, so that large numbers are 
    # contain appropriate commas. 
    def page_number(page)
      unless page == current_page
        text = @template.number_with_delimiter(page)
        link(text, page, :rel => rel_value(page))
      else
        tag(:em, page)
      end
    end
    
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blacklight-3.1.2 lib/blacklight/comma_link_renderer.rb
blacklight-3.1.1 lib/blacklight/comma_link_renderer.rb
blacklight-3.1.0 lib/blacklight/comma_link_renderer.rb
blacklight-3.0.0 lib/blacklight/comma_link_renderer.rb
blacklight-3.0.0pre8 lib/blacklight/comma_link_renderer.rb
blacklight-3.0.0pre7 lib/blacklight/comma_link_renderer.rb