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, #gui_element_id, #parent, #tag

Instance Method Summary collapse

Methods inherited from Element

#+, #<<, #[], #[]=, #add_class, #aurita_gui_element, #clear_floating, #css_classes, #find_by_dom_id, #get_content, #has_content?, #id, #id=, #inspect, #js_init_code, #length, #method_missing, #recurse, #remove_class, #set_content, #string, #swap, #to_ary, #touch, #touched?, #type=, #untouch

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.



134
135
136
137
138
# File 'lib/aurita-gui/form.rb', line 134

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