9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/stimulus_plumbers/form/fields/inputs/select/timezone.rb', line 9
def time_zone_select(attribute, priority_zones = nil, options = {}, html_options = {})
html_native = options.delete(:html_native) { false }
Field.new(@template, **options).render(object, attribute, input_id: field_id(attribute)) do |html_opts, opts, error|
merged_html_opts = merge_html_options(html_options, html_opts, field_theme(:form_select, error: error))
if html_native
super(attribute, priority_zones, opts, merged_html_opts)
else
render_select_dropdown(attribute, opts, merged_html_opts, err: error) do
model = opts.delete(:model) { ActiveSupport::TimeZone }
build_zone_choices(priority_zones, model.all)
end
end
end
end
|