class DistrictCnSelector::SelectSelector
Constants
- BLANK
Public Instance Methods
build_one(type)
click to toggle source
# File lib/district_cn_selector/selector.rb, line 190 def build_one(type) selected_scope = options["selected_#{type}".intern] selected_scopes = options["selected_#{type.to_s.pluralize}".intern] instance_tag.to_select_tag( selected_scopes.unshift(BLANK[type]), {:selected =>selected_scope && selected_scope[1]}.merge(options), {:id=>nil,:class=>type}.merge(html_options) ) end
build_select(type)
click to toggle source
# File lib/district_cn_selector/selector.rb, line 182 def build_select(type) content_tag( :div, [public_send("select_#{type}"), build_hidden, javascript_tag].join.html_safe, :class => "#{secure_random}" ) end
javascript_tag()
click to toggle source
# File lib/district_cn_selector/selector.rb, line 162 def javascript_tag javascript = <<-JAVASCRIPT <script> if(window.AREA_SELECT_CN_DISTRICT_FIELDS === undefined) { window.AREA_SELECT_CN_DISTRICT_FIELDS = []; } window.AREA_SELECT_CN_DISTRICT_FIELDS.push( [".#{secure_random}", { onChange: function($container,code){ $container.find(".select-value").val(code); } } ] ); </script> JAVASCRIPT javascript end