Class: Lapillus::Fragment

Inherits:
Container show all
Defined in:
lib/lapillus/containers.rb

Direct Known Subclasses

SingleView

Instance Attribute Summary

Attributes inherited from Container

#components

Attributes inherited from Component

#behaviours, #identifier, #model, #property, #visible

Instance Method Summary collapse

Methods inherited from Container

#[], #add, add_component, #component, fileuploadfield, image, label, listview, panel, password_textfield, #post, textarea, textfield

Methods inherited from Component

#add_behaviour, #behaviour, #has_behaviour?, #has_model?, #has_parent?, #parent, #path, #response_page=, #session, #value, #webpage

Methods inherited from RenderableComponent

#on_render, #render_behaviours, #render_component, #render_container, #render_to_element, #visible?

Constructor Details

#initialize(id, fragment_id, options = {}) ⇒ Fragment

Returns a new instance of Fragment.



163
164
165
166
# File 'lib/lapillus/containers.rb', line 163

def initialize(id, fragment_id, options={})
  super(id, options)
  @fragment_id = fragment_id
end

Instance Method Details

#render_children(visitor, template_element) ⇒ Object



168
169
170
171
172
173
# File 'lib/lapillus/containers.rb', line 168

def render_children(visitor, template_element)
  root_node = template_element.root
  fragment = REXML::XPath.first( root_node, "//*[@lapillus:id=\"#{@fragment_id}\"]" )
  raise "Fragment with identifier "+@fragment_id+" not found!" if fragment == nil 
  super(visitor, fragment)
end