Module: FormtasticBootstrap::Inputs::Base::Errors
- Includes:
- Formtastic::Inputs::Base::Errors
- Included in:
- FormtasticBootstrap::Inputs::Base
- Defined in:
- lib/formtastic-bootstrap/inputs/base/errors.rb
Instance Method Summary collapse
- #error_first_html(inline_or_block = :inline) ⇒ Object
- #error_html(inline_or_block = :inline) ⇒ Object
- #error_list_html(ignore) ⇒ Object
- #error_none_html(ignore) ⇒ Object
- #error_sentence_html(inline_or_block) ⇒ Object
Instance Method Details
#error_first_html(inline_or_block = :inline) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/formtastic-bootstrap/inputs/base/errors.rb', line 31 def error_first_html(inline_or_block = :inline) error_class = if inline_or_block == :inline [:error_class] || builder.default_inline_error_class else [:error_class] || builder.default_block_error_class end template.content_tag(:span, Formtastic::Util.html_safe(errors.first.untaint), :class => error_class) end |
#error_html(inline_or_block = :inline) ⇒ Object
8 9 10 |
# File 'lib/formtastic-bootstrap/inputs/base/errors.rb', line 8 def error_html(inline_or_block = :inline) errors? ? send(:"error_#{builder.inline_errors}_html", inline_or_block) : "" end |
#error_list_html(ignore) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/formtastic-bootstrap/inputs/base/errors.rb', line 21 def error_list_html(ignore) super() # error_class = options[:error_class] || builder.default_error_list_class # list_elements = [] # errors.each do |error| # list_elements << template.content_tag(:li, Formtastic::Util.html_safe(error.html_safe)) # end # template.content_tag(:ul, Formtastic::Util.html_safe(list_elements.join("\n")), :class => error_class) end |
#error_none_html(ignore) ⇒ Object
40 41 42 43 |
# File 'lib/formtastic-bootstrap/inputs/base/errors.rb', line 40 def error_none_html(ignore) # super "" end |
#error_sentence_html(inline_or_block) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/formtastic-bootstrap/inputs/base/errors.rb', line 12 def error_sentence_html(inline_or_block) error_class = if inline_or_block == :inline [:error_class] || builder.default_inline_error_class else [:error_class] || builder.default_block_error_class end template.content_tag(:span, Formtastic::Util.html_safe(errors.to_sentence.html_safe), :class => error_class) end |