Sha256: 5827981ff7390acdf2742207490f0ce5937ddbf189d37d0e8a166db7b4db689c
Contents?: true
Size: 686 Bytes
Versions: 29
Compression:
Stored size: 686 Bytes
Contents
require 'active_scaffold/paginator' class Paginator # Total number of pages def number_of_pages_with_infinite number_of_pages_without_infinite if @count end alias_method_chain :number_of_pages, :infinite # Is this an "infinite" paginator def infinite? @count.nil? end def count @count || first.items.size end class Page # Checks to see if there's a page after this one def next_with_infinite? return true if @pager.infinite? next_without_infinite? end alias_method_chain :next?, :infinite def empty? if @pager.infinite? items.to_a.empty? else @pager.count == 0 end end end end
Version data entries
29 entries across 29 versions & 1 rubygems