3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/formatted_form/view_helper.rb', line 3
def formatted_form_for(record, options = {}, &proc)
options = options.dup
options[:builder] ||= FormattedForm::FormBuilder
options[:html] ||= { }
options[:html][:class] ||= 'formatted'
if type = options[:html][:class].match(/form-(inline|horizontal|search)/)
options[:type] ||= type[1].try(:to_sym)
elsif options[:type].present?
form_class = case options[:type]
when :inline then 'form-inline'
when :horizontal then 'form-horizontal'
when :search then 'form-search'
end
options[:html][:class] = "#{options[:html][:class]} #{form_class}".strip
end
options[:type] ||= :vertical
options[:type] = options[:type].to_sym
form_for(record, options, &proc)
end
|