Class: Aurita::GUI::Select_Field
- Inherits:
-
Options_Field
- Object
- Array
- Element
- Form_Field
- Options_Field
- Aurita::GUI::Select_Field
- Defined in:
- lib/aurita-gui/form/select_field.rb
Instance Attribute Summary
Attributes inherited from Options_Field
#option_labels, #options, #options_range, #value
Attributes inherited from Form_Field
#data_type, #form, #hidden, #hint, #invalid, #label, #required, #type, #value
Attributes inherited from Element
#attrib, #force_closing_tag, #parent, #tag
Instance Method Summary collapse
Methods inherited from Options_Field
#[], #[]=, #add_option, #content, #initialize
Methods inherited from Form_Field
#disable!, #disabled=, #editable!, #enable!, #hidden?, #hide!, #initialize, #invalid!, #invalid?, #optional!, #readonly!, #readonly=, #readonly?, #required!, #required?, #show!, #to_hidden_field, #to_s
Methods inherited from Element
#+, #<<, #[], #[]=, #add_class, #clear_floating, #css_classes, #find_by_dom_id, #get_content, #has_content?, #id, #id=, #initialize, #method_missing, #recurse, #remove_class, #set_content, #string, #swap, #to_ary, #type=
Methods included from Marshal_Helper_Class_Methods
Methods included from Marshal_Helper
Constructor Details
This class inherits a constructor from Aurita::GUI::Options_Field
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Aurita::GUI::Element
Instance Method Details
#element ⇒ Object
26 27 28 29 30 |
# File 'lib/aurita-gui/form/select_field.rb', line 26 def element HTML.select(@attrib) { option_elements() } end |
#option_elements ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/aurita-gui/form/select_field.rb', line 8 def option_elements = [] @option_elements.each { |option| if option.kind_of? Hash then option.each_pair { |k,v| selected = (@value && k.to_s == @value.to_s)? true : nil << HTML.option(:value => k, :selected => selected) { v } } elsif option.kind_of? Element then option.tag = :option << option else selected = (@value && option.to_s == @value.to_s)? true : nil << HTML.option(:value => option, :selected => selected) { option } end } end |
#readonly_element ⇒ Object
31 32 33 34 35 |
# File 'lib/aurita-gui/form/select_field.rb', line 31 def readonly_element HTML.div(@attrib) { @options[@value] } end |