Module: ChineseRegionsRails::Builder

Defined in:
lib/chinese_regions_rails/helper.rb

Instance Method Summary collapse

Instance Method Details

#city_picker(method, options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/chinese_regions_rails/helper.rb', line 21

def city_picker(method, options = {})
  HelperUtil.setup_options(options)

  options[:name] = nil

  value = retrive_value(method)
  _raw_label = HelperUtil.raw_label(value)
  _raw_value = HelperUtil.raw_value(value)

  options[:value] = _raw_label

  output = ActiveSupport::SafeBuffer.new
  output << text_field(nil, options)
  output << hidden_field(method, {
                           value: _raw_value,
                           data: { "city-picker-value-for" => options[:data][:id] }
                         })
end