diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index ac666d1a..5041e5d7 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -8,6 +8,7 @@ * Add form_class configuration option (by github.com/fagiani) * Default step of "any" for number input with non integer attributes (by github.com/fedesoria) * Add option to disable HTML5 browser validations on all forms (by github.com/coryschires) + * Add option to diable all HTML% extensions (by github.com/wolframarnold) * bug fix * Fix for file attributes automatic detection, to work with virtual attributes diff --git a/lib/generators/simple_form/templates/simple_form.rb b/lib/generators/simple_form/templates/simple_form.rb index de999a24..44d62a0b 100644 --- a/lib/generators/simple_form/templates/simple_form.rb +++ b/lib/generators/simple_form/templates/simple_form.rb @@ -64,6 +64,11 @@ SimpleForm.setup do |config| # Tell browsers whether to use default HTML5 validations (novalidate option). Default is enabled. # config.disable_browser_validations = false + # Determines whether HTML5 types (:email, :url, :search, :tel) and attributes (e.g. required) are used + # or not. True by default. + # Having this on in non-HTML5 compliant sites can cause odd behavior in HTML5-aware browsers such as Chrome. + # config.use_html5 = true + # Custom mappings for input types. This should be a hash containing a regexp # to match as key, and the input type that will be used when the field name # matches the regexp as value. @@ -83,9 +88,4 @@ SimpleForm.setup do |config| # When false, do not use translations for labels, hints or placeholders. # config.translate = true - - # Determines whether HTML5 types (:email, :url, :search, :tel) and attributes (e.g. required) are used - # or not. True by default. - # Having this on in non-HTML5 compliant sites can cause odd behavior in HTML5-aware browsers such as Chrome. - # config.use_html5 = true end diff --git a/lib/simple_form.rb b/lib/simple_form.rb index e3c3ab23..5076ff09 100644 --- a/lib/simple_form.rb +++ b/lib/simple_form.rb @@ -95,6 +95,12 @@ module SimpleForm mattr_accessor :disable_browser_validations @@disable_browser_validations = false + # Determines whether HTML5 types (:email, :url, :search, :tel) and attributes (e.g. required) are used + # or not. True by default. + # Having this on in non-HTML5 compliant sites can cause odd behavior in HTML5-aware browsers such as Chrome. + mattr_accessor :use_html5 + @@use_html5 = true + # Collection of methods to detect if a file type was given. mattr_accessor :file_methods @@file_methods = [ :mounted_as, :file?, :public_filename ] @@ -122,12 +128,6 @@ module SimpleForm mattr_accessor :translate @@translate = true - # Determines whether HTML5 types (:email, :url, :search, :tel) and attributes (e.g. required) are used - # or not. True by default. - # Having this on in non-HTML5 compliant sites can cause odd behavior in HTML5-aware browsers such as Chrome. - mattr_accessor :use_html5 - @@use_html5 = true - # Default way to setup SimpleForm. Run rails generate simple_form:install # to create a fresh initializer with all configuration values. def self.setup