BatchedList.rb

Path: lib/Borges/Component/BatchedList.rb
Last Update: Fri Apr 23 11:49:48 PDT 2004

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

[Validate]