Class | Ramaze::Helper::Paginate::Paginator
In: | lib/ramaze/helper/paginate.rb
Parent: | Object

Provides easy pagination and navigation

### Methods

count current_page each empty? first_page? last_page last_page? navigation needed? new next_page page_count prev_page

### Included Modules

Ramaze::Helper

### Classes and Modules

Class Ramaze::Helper::Paginate::Paginator::ArrayPager
Class Ramaze::Helper::Paginate::Paginator::DataMapperPager

### Public Class methods

new(data = [], page = 1, limit = 10, var = 'pager')

### Public Instance methods

count()
current_page()
each(&block)
empty?()
first_page?()
last_page()
last_page?()
navigation(limit = 8)

Returns String with navigation div.

This cannot be customized very nicely, but you can style it easily with CSS.

Output with 5 elements, page 1, limit 3:

        <div class="pager">
          <span class="first grey">&lt;&lt;</span>
          <span class="previous grey">&lt;</span>
          <a class="current" href="/index?pager=1">1</a>
          <a href="/index?pager=2">2</a>
          <a class="next" href="/index?pager=2">&gt;</a>
          <a class="last" href="/index?pager=2">&gt;&gt;</a>
        </div>

Output with 5 elements, page 2, limit 3:

        <div class="pager" />
          <a class="first" href="/index?user_page=1">&lt;&lt;</a>
          <a class="previous" href="/index?user_page=1">&lt;</a>
          <a href="/index?user_page=1">1</a>
          <a class="current" href="/index?user_page=2">2</a>
          <span class="next grey">&gt;</span>
          <span class="last grey">&gt;&gt;</span>
        </div>

needed?()

Useful to omit pager if it‘s of no use.

next_page()
page_count()

these methods are actually on the pager, but we def them here for convenience (method_missing in helper is evil and even slower)

prev_page()

[Validate]