diff --git a/lib/formtastic-bootstrap/form_builder.rb b/lib/formtastic-bootstrap/form_builder.rb index 8a524e0e..c3de423a 100644 --- a/lib/formtastic-bootstrap/form_builder.rb +++ b/lib/formtastic-bootstrap/form_builder.rb @@ -31,6 +31,7 @@ def self.default_hint_class=(hint_class) include FormtasticBootstrap::Helpers::InputHelper # Revisit include FormtasticBootstrap::Helpers::InputsHelper + include FormtasticBootstrap::Helpers::ErrorsHelper include FormtasticBootstrap::Helpers::ActionHelper include FormtasticBootstrap::Helpers::ActionsHelper # include Formtastic::Helpers::ErrorsHelper diff --git a/lib/formtastic-bootstrap/helpers/errors_helper.rb b/lib/formtastic-bootstrap/helpers/errors_helper.rb new file mode 100644 index 00000000..4c956f4c --- /dev/null +++ b/lib/formtastic-bootstrap/helpers/errors_helper.rb @@ -0,0 +1,70 @@ +module FormtasticBootstrap + module Helpers + module ErrorsHelper + include Formtastic::Helpers::FileColumnDetection + include Formtastic::Helpers::Reflection + include Formtastic::LocalizedString + + INLINE_ERROR_TYPES = [:sentence, :list, :first] + + # Generates a bootstrap error alert element containing + # an unordered list of error messages on the base object and optionally for a given + # set of named attribute. This is idea for rendering a block of error messages at the top of + # the form for hidden/special/virtual attributes (the Paperclip Rails plugin does this), or + # errors on the base model. + # + # A hash can be used as the last set of arguments to pass HTML attributes to the `