Class: N::UI::Select
- Inherits:
-
Object
- Object
- N::UI::Select
- Defined in:
- lib/n/ui/select.rb
Class Method Summary collapse
-
.render_options(paramvalue, values, options) ⇒ Object
Generalized select.
Class Method Details
.render_options(paramvalue, values, options) ⇒ Object
Generalized select. Dont create the enclosing selects to be flexible. Example:
<select name=“param” onchange=“submit()”> # paramvalue, [-1, 1, 2, 3], [“– Enter Options –”, “Man”, “Woman”, “None”] ) </select>
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/n/ui/select.rb', line 24 def self.(paramvalue, values, ) str = "" values.each_with_index { |val, idx| if paramvalue == val str << %{<option value="#{val}" selected="1">#{[idx]}</option>} else str << %{<option value="#{val}">#{[idx]}</option>} end } return str end |