Sha256: d2dc465f508d356335a69cff3abbe59cea0a78742ff1b3ba8d04edc86bb47a7a
Contents?: true
Size: 549 Bytes
Versions: 2
Compression:
Stored size: 549 Bytes
Contents
require 'nitro/control/relation' module Nitro # RefersTo. Also used for BelongsTo. class RefersToControl < RelationControl def render %{ #{emit_label} <select id="#{rel.name}_ctl" name="#{rel.name}"#{emit_disabled}> #{emit_options} </select> } end def emit_options objs = rel.target_class.all selected = selected.pk if selected = value %{ <option value="">--</option> #{options(:labels => objs.map{|o| o.to_s}, :values => objs.map{|o| o.pk}, :selected => selected)} } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.41.0 | lib/nitro/control/relation/refers_to.rb |
nitro-0.40.0 | lib/nitro/control/relation/refers_to.rb |