Class: Lapillus::ListItem

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

Overview

TODO: Add test!

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, #initialize, label, listview, panel, password_textfield, #post, #render_children, textarea, textfield

Methods inherited from Component

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

Methods inherited from RenderableComponent

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

Constructor Details

This class inherits a constructor from Lapillus::Container

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object



99
100
101
# File 'lib/lapillus/containers.rb', line 99

def method_missing(method)
  component(method.to_s)
end

Instance Method Details

#image(id, options = {}) ⇒ Object



110
111
112
113
114
115
# File 'lib/lapillus/components.rb', line 110

def image(id, options={})
  options.keys.each {|key|
    raise "Unknown key: #{key}" if key!=:model and key!=:root_url  
  }
  add(Image.new(id, options))
end

#label(id, options = {}) ⇒ Object



32
33
34
35
36
37
# File 'lib/lapillus/components.rb', line 32

def label(id, options={})
  options.keys.each {|key|
    raise "Unknown key: #{key}" if key!=:model and key!=:property  
  }
  add(Label.new(id, options))
end

#panel(id, clazz, model = nil, options = {}) ⇒ Object



187
188
189
# File 'lib/lapillus/containers.rb', line 187

def panel(id, clazz, model=nil, options={})
  add(clazz.new(id, model))
end