making 'simple_form' the default form class but allowing to change

This commit is contained in:
Paulo Fagiani 2011-03-08 06:13:28 +08:00 committed by Carlos Antonio da Silva
parent 45bd019f04
commit 15e051a6db
3 changed files with 8 additions and 1 deletions

View File

@ -55,6 +55,9 @@ SimpleForm.setup do |config|
# You can define the class to use on all labels. Default is nil.
# config.label_class = nil
# You can define the class to use on all forms. Default is simple_form.
# config.form_class = :simple_form
# Whether attributes are required by default (or not). Default is true.
# config.required_by_default = true

View File

@ -83,6 +83,10 @@ module SimpleForm
mattr_accessor :label_class
@@label_class = nil
# You can define the class to use on all forms. Default is simple_form.
mattr_accessor :form_class
@@form_class = :simple_form
# Whether attributes are required by default (or not).
mattr_accessor :required_by_default
@@required_by_default = true

View File

@ -40,7 +40,7 @@ module SimpleForm
else dom_class(record_or_name_or_array)
end
options[:html] ||= {}
options[:html][:class] = "simple_form \#{css_class} \#{options[:html][:class]}".strip
options[:html][:class] = "\#{SimpleForm.form_class} \#{css_class} \#{options[:html][:class]}".strip
with_custom_field_error_proc do
#{helper}(record_or_name_or_array, *(args << options), &block)