Class: Aurita::GUI::Select_Field
- Inherits:
-
Options_Field
- Object
- 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
Attributes inherited from Element
#attrib, #content, #parent, #tag, #type
Instance Method Summary collapse
Methods inherited from Options_Field
#[], #[]=, #add_option, #content, #initialize
Methods inherited from Form_Field
#disable!, #editable!, #enable!, #initialize, #readonly!, #readonly?, #to_s
Methods inherited from Element
#+, #[], #[]=, #clear_floating, #dom_id, #dom_id=, #each, #empty?, #id, #id=, #initialize, #length, #method_missing, #string, #to_ary
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 |