Sha256: 2f7ce4c213c6cbb6a3a25be15b502073dee34ab363d3838616afe9292ea690be

Contents?: true

Size: 512 Bytes

Versions: 5

Compression:

Stored size: 512 Bytes

Contents

ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| 
  if html_tag =~ /<(input|textarea|select)/
    errors = instance.error_message.kind_of?(Array) ? instance.error_message : [instance.error_message]
    errors.collect! { |error| "<li>#{error}</li>" } 
    message = "<ul class='error_box error_box_narrow'>#{errors.join}</ul>".html_safe
    html_tag += message
  end
  
  if html_tag =~ /<label/
    html_tag
  else
    "<div class=\"field_with_errors\">#{html_tag}</div>".html_safe
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
freeberry-0.3.0 lib/generators/freeberry/base/templates/config/freeberry.rb
freeberry-0.2.9 lib/generators/freeberry/base/templates/config/freeberry.rb
freeberry-0.2.7 lib/generators/freeberry/base/templates/config/freeberry.rb
freeberry-0.2.6 lib/generators/freeberry/base/templates/config/freeberry.rb
freeberry-0.2.5 lib/generators/freeberry/base/templates/config/freeberry.rb