Class: Nitro::Form::RefersToControl
- Defined in:
- lib/nitro/helper/form/controls.rb
Overview
RefersTo. Also used for BelongsTo.
Instance Attribute Summary
Attributes inherited from Control
Instance Method Summary collapse
Methods inherited from Control
fetch, #initialize, #label, #on_populate
Methods included from XhtmlHelper
#date_select, #datetime_select, #hidden, #href_of, #js_popup, #link_to, #onclick_popup, #options, #popup, #submit, #time_select
Constructor Details
This class inherits a constructor from Nitro::Form::Control
Instance Method Details
#emit_options ⇒ Object
244 245 246 247 248 249 250 251 |
# File 'lib/nitro/helper/form/controls.rb', line 244 def objs = rel.target_class.all selected = selected.pk if selected = value %{ <option value="nil">None</option> #{options(:labels => objs.map{|o| o.to_s}, :values => objs.map{|o| o.pk}, :selected => selected)} } end |
#render ⇒ Object
236 237 238 239 240 241 242 |
# File 'lib/nitro/helper/form/controls.rb', line 236 def render %{ <select id="#{rel.name}_ctl" name="#{rel.name}"#{emit_disabled}> #{emit_options} </select> } end |