Module: ActiveScaffold::Bridges::CountryHelper::InstanceTagMethods

Included in:
ActionView::Helpers::Tags::CountrySelect
Defined in:
lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb

Instance Method Summary collapse

Instance Method Details

#to_country_select_tag(priority_countries, options, html_options) ⇒ Object



311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb', line 311

def to_country_select_tag(priority_countries, options, html_options)
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  value = value(object)
  selected_value = options.key?(:selected) ? options[:selected] : value
  (
    'select',
    add_options(
      country_options_for_select(selected_value, priority_countries),
      options, selected_value
    ), html_options
  )
end

#to_usa_state_select_tag(priority_states, options, html_options) ⇒ Object



325
326
327
328
329
330
331
# File 'lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb', line 325

def to_usa_state_select_tag(priority_states, options, html_options)
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  value = value(object)
  selected_value = options.key?(:selected) ? options[:selected] : value
  ('select', add_options(usa_state_options_for_select(selected_value, priority_states), options, selected_value), html_options)
end