10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/form_props/form_options_helper.rb', line 10
def grouped_options_for_select(grouped_options, selected_key = nil, options = {})
prompt = options[:prompt]
divider = options[:divider]
options = []
if prompt
options.push({
label: prompt_text(prompt),
value: ""
})
end
grouped_options.each do |container|
html_attributes = option_html_attributes(container)
if divider
label = divider
else
label, container = container
end
options.push({label: label, options: options_for_select(container, selected_key)}
.merge!(html_attributes))
end
options
end
|