69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/core_extensions/action_view/helpers/form_options_helper.rb', line 69
def to_country_select_tag(countries, options = {}, html_options = {})
html_options = html_options.stringify_keys
add_default_name_and_id(html_options)
options[:include_blank] ||= true unless options[:prompt] || select_not_required?(html_options)
value = options[:selected] ? options[:selected] : value(object)
priority_regions = options[:priority] || []
opts = add_options(country_options_for_select(countries, value, :priority => priority_regions), options, value)
select = content_tag("select", opts, html_options)
if html_options["multiple"] && options.fetch(:include_hidden, true)
tag("input", :disabled => html_options["disabled"], :name => html_options["name"], :type => "hidden", :value => "") + select
else
select
end
end
|