In: |
lib/Borges/Component/BatchedList.rb
|
Parent: | Object |
A BatchedList paginates a list of items.
The user must render the currently displayed list and the page bar.
Example:
class MyList < Borges::Component
def initialize(items) @batcher = Borges::BatchedList.new(items) end def choose(item) call(MyView.new(item)) # MyView is a component that views the item. end def renderContentOn(r) r.list_do(@batcher.batch) do |item| r.anchor(item.title do choose(item) end end r.render(@batcher) end
end
DEFAULT_SIZE | = | 10 |
batch_size | [RW] | |
current_page | [RW] | |
items | [RW] |