Hobo Cookbook

View Source

Rapid

<filter-menu>

A <select> menu intended to act as a filter for index pages.

Example

Filtering on state is a common use. Here’s the dryml for Order:

<filter-menu param-name="state" options="&Order::Lifecycle.states.keys" />

And the controller action:

def index
  # always validate data given in URL's!!!
  params[:state]=nil unless Order::Lifecycle.states.include?(params[:state]._?.to_sym)
  finder = params[:state] ? Order.send(params[:state]) : Order
  hobo_index finder
end

See Filtering stories by status in the Agility Tutorial for an example.

Attributes

  • param-name - the name of the HTTP parameter to use for the filter
  • options - an array of options for the menu.
  • no-filter - The text of the first option which indicates no filter is in effect. Defaults to ‘All’

Show Source

Comments

No comments to display