| In: |
lib/Borges/Component/BigBatchedList.rb
|
| Parent: | Object |
A BigBatchedList paginates a list of items; as opposed to the simple BatchedList, this class only displays an environment of N pages to be accessed directly around the current one.
The user must render the currently displayed list and the page bar.
Example:
class MyList < Borges::Component
def initialize(items)
@batcher = Borges::BigBatchedList.new(items, 5)
end
def choose(item)
call(MyView.new(item)) # MyView is a component that views the item.
end
def render_content_on(r)
r.list_do(@batcher.batch) do |item|
r.anchor(item.title do choose(item) end
end
r.render(@batcher)
end
end
| DEFAULT_ENV | = | 5 |
| environment | [RW] |
Create a new BigBatchedList from items, with size items per page, and links environment immediately surrounding pages.