| Module | PrettyAccessibleForm |
| In: |
vendor/plugins/pretty_accessible_form/lib/pretty_accessible_form.rb
|
Build a form after Pretty Accessible Forms
# File vendor/plugins/pretty_accessible_form/lib/pretty_accessible_form.rb, line 84
84: def pa_form_for(object_name, *args, &proc)
85: options = args.last.is_a?(Hash) ? args.last : {}
86: if options[:html].nil? then
87: options[:html] = { :class => "cmxform" }
88: else
89: options[:html][:class] = (options[:html][:class].nil?) ? "cmxform" : "#{options[:html][:class]} cmxform"
90: end
91: legend = options.delete :legend
92: if legend.blank?
93: prefix = "<fieldset><ol>"
94: postfix = "</fieldset></ol>"
95: else
96: prefix = "<fieldset><legend>#{legend}</legend><ol>"
97: postfix = '</ol></fieldset>'
98: end
99:
100: custom_form_for(
101: PAFormBuilder, prefix, postfix,
102: form_tag(options.delete(:url) || {}, options.delete(:html) || {}),
103: object_name, *args, &proc)
104: end
# File vendor/plugins/pretty_accessible_form/lib/pretty_accessible_form.rb, line 106
106: def pa_remote_form_for(object_name, *args, &proc)
107: options = args.last.is_a?(Hash) ? args.last : {}
108: if options[:html].nil? then
109: options[:html] = { :class => "cmxform" }
110: else
111: options[:html][:class] = (options[:html][:class].nil?) ? "cmxform" : "#{options[:html][:class]} cmxform"
112: end
113: legend = options.delete :legend
114: if legend.blank?
115: prefix = "<fieldset><ol>"
116: postfix = "</ol></fieldset>"
117: else
118: prefix = "<fieldset><legend>#{legend}</legend><ol>"
119: postfix = '</ol></fieldset>'
120: end
121: custom_form_for(PAFormBuilder, prefix, postfix, form_remote_tag(options), object_name, *args, &proc)
122: end