Added error notification class and id as configuration option
This commit is contained in:
parent
5c1db60dfd
commit
693153d169
|
@ -22,6 +22,12 @@ SimpleForm.setup do |config|
|
|||
# Default tag used for error notification helper.
|
||||
# config.error_notification_tag = :p
|
||||
|
||||
# CSS class to add for error notification helper.
|
||||
# config.error_notification_class = ''
|
||||
|
||||
# ID to add for error notification helper.
|
||||
# config.error_notification_id = ''
|
||||
|
||||
# You can wrap all inputs in a pre-defined tag.
|
||||
# config.wrapper_tag = :div
|
||||
|
||||
|
|
|
@ -35,6 +35,14 @@ module SimpleForm
|
|||
mattr_accessor :error_notification_tag
|
||||
@@error_notification_tag = :p
|
||||
|
||||
# CSS class to add for error notification helper.
|
||||
mattr_accessor :error_notification_class
|
||||
@@error_notification_class = nil
|
||||
|
||||
# ID to add for error notification helper.
|
||||
mattr_accessor :error_notification_id
|
||||
@@error_notification_id = nil
|
||||
|
||||
# Components used by the form builder.
|
||||
mattr_accessor :components
|
||||
@@components = [ :label_input, :hint, :error ]
|
||||
|
|
|
@ -26,7 +26,9 @@ module SimpleForm
|
|||
end
|
||||
|
||||
def html_options
|
||||
@options[:class] = "error_notification #{@options[:class]}".strip
|
||||
css_class = SimpleForm.error_notification_class || @options[:class]
|
||||
@options[:class] = "error_notification #{css_class}".strip
|
||||
@options[:id] = SimpleForm.error_notification_id if SimpleForm.error_notification_id
|
||||
@options
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue