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

Version Path
active_scaffold-3.4.43 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.42 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.41.1 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.41 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.40 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.39 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.38 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.37 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.36 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.35 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.34 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.33 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.32 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.31 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.30 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.29 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.28 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.27 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.26 lib/active_scaffold/extensions/paginator_extensions.rb
active_scaffold-3.4.25 lib/active_scaffold/extensions/paginator_extensions.rb