Class: Aurita::GUI::Form_Content_Wrapper

Inherits:
Element
  • Object
show all
Defined in:
lib/aurita-gui/form.rb

Overview

Default decorator for form contents (list of form fields). Decorates all entries of form to <ul> element, setting CSS class ‘form_field’. To use your own field decorator, derive it from Aurita::GUI::Element (maybe indirectly via one of its derivates) and define its constructor to expect a list of Form_Field instances as content attribute (either in params or as block). The content decorator has to wrap the actual array of form fields.

See the source code of Aurita::GUI::Form_Content_Wrapper for a simple implementation.

Tell a form to use a specific content decorator by

the_form.content_decorator = My_Content_Decorator

To use your own implementation as defaut, overload Form.initialize like

class My_Form < Aurita::GUI::Form
  def initialize(params={}, &block)
    super(params, &block)
    @content_decorator = My_Content_Decorator
  emd
end

Or write a factory (*hint hint*) like:

class Form_Factory
  def self.form(params={}, &block)
    form = Aurita::GUI::Form.new(params, &block)
    form.content_decorator = My_Content_Decorator
    return form
  end
end

See also: Form_Field_Wrapper (pretty much the same).

Instance Attribute Summary

Attributes inherited from Element

#attrib, #force_closing_tag, #parent, #tag

Instance Method Summary collapse

Methods inherited from Element

#+, #<<, #[], #[]=, #add_class, #clear_floating, #css_classes, #find_by_dom_id, #get_content, #has_content?, #id, #id=, #method_missing, #recurse, #remove_class, #set_content, #string, #swap, #to_ary, #type=

Methods included from Marshal_Helper_Class_Methods

#marshal_load

Methods included from Marshal_Helper

#marshal_dump

Constructor Details

#initialize(params = {}, &block) ⇒ Form_Content_Wrapper

Returns a new instance of Form_Content_Wrapper.



128
129
130
131
132
# File 'lib/aurita-gui/form.rb', line 128

def initialize(params={}, &block)
  params[:tag]     = :ul
  params[:class]   = :form_fields
  super(params, &block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Aurita::GUI::Element