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_container, textarea, textfield

Methods inherited from Component

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

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



103
104
105
# File 'lib/lapillus/containers.rb', line 103

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

Instance Method Details

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



108
109
110
111
112
113
# File 'lib/lapillus/components.rb', line 108

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

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



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

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

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



196
197
198
# File 'lib/lapillus/containers.rb', line 196

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