Class | Apotomo::Widget |
In: |
lib/apotomo/widget.rb
|
Parent: | Cell::Rails |
Apotomo tries to prevent you from having to access the global params hash. We have the following concepts to retrieve input data.
when creating the widget tree. Use options for reading.
has_widgets do |root| root << widget(:mouse_widget, 'mum', :favorites => ["Gouda", "Chedar"])
and read in your widget state
def display @cheese = options[:favorites].first
Use the #[] shortcut to access values directly.
def update(evt) @cheese = Cheese.find evt[:cheese_id]
name | -> | widget_id |
name | [R] | |
options | [R] | |
visible | [W] |
Renders and returns a view for the current state. That‘s why it is usually called at the end of a state method.
Example:
class MouseWidget < Apotomo::Widget def eat render end
render the view eat.haml.
render :text => "alert('SQUEAK!');"
issues a squeaking alert dialog on the page.