3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/helpers/simple_admin/form_helper.rb', line 3
def form_fields(form, attributes)
attributes.map do |col|
options = (col[:options] || {}).dup
expand_block_options!(options)
case col[:kind]
when :attribute
form.input col[:attribute], options
when :content
instance_exec(@resource, form, col, &col[:data])
when :fieldset
content_tag :fieldset, options do
content_tag :legend do
options[:legend]
end unless options[:legend].blank
form_fields(form, col[:attributes])
end
else
content_tag :div, options do
form_fields(form, col[:attributes])
end
end
end.join.html_safe
end
|