Class: MultiView
- Inherits:
- Lapillus::Component show all
- Defined in:
- lib/lapillus/multiview.rb
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
Attributes inherited from Lapillus::Component
#behaviours, #identifier, #model, #property, #visible
Instance Method Summary collapse
-
#[](path) ⇒ Object
TODO: add test.
-
#component(identifier) ⇒ Object
TODO: add test.
- #current_view ⇒ Object
-
#initialize(id, views) ⇒ MultiView
constructor
A new instance of MultiView.
-
#post(values) ⇒ Object
TODO: add test.
- #render_children(visitor, html) ⇒ Object
Methods inherited from Lapillus::Component
#add_behaviour, #behaviour, #has_behaviour?, #has_model?, #has_parent?, #parent, #path, #response_page=, #session, #value, #webpage
Methods inherited from Lapillus::RenderableComponent
#on_render, #render_behaviours, #render_component, #render_container, #render_to_element, #visible?
Constructor Details
#initialize(id, views) ⇒ MultiView
Returns a new instance of MultiView.
11 12 13 14 15 16 |
# File 'lib/lapillus/multiview.rb', line 11 def initialize(id, views) super(id) @views = views views.each {|view| view.parent = self } #TODO: add test! @mode=views[0].identifier end |
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
10 11 12 |
# File 'lib/lapillus/multiview.rb', line 10 def mode @mode end |
Instance Method Details
#[](path) ⇒ Object
TODO: add test
41 42 43 |
# File 'lib/lapillus/multiview.rb', line 41 def [](path) current_view[path] end |
#component(identifier) ⇒ Object
TODO: add test
37 38 39 |
# File 'lib/lapillus/multiview.rb', line 37 def component(identifier) return current_view.component(identifier) end |
#current_view ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/lapillus/multiview.rb', line 18 def current_view @views.each do |v| return v if v.identifier == mode end raise "view with identifier #{id} not found!" nil end |
#post(values) ⇒ Object
TODO: add test
33 34 35 |
# File 'lib/lapillus/multiview.rb', line 33 def post(values) current_view.post(values) end |
#render_children(visitor, html) ⇒ Object
26 27 28 29 30 |
# File 'lib/lapillus/multiview.rb', line 26 def render_children(visitor, html) singleview = current_view visitor.current_container = singleview singleview.render_children(visitor, html) end |