Skip to content

Instantly share code, notes, and snippets.

@nmerouze
Created August 18, 2008 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmerouze/5968 to your computer and use it in GitHub Desktop.
Save nmerouze/5968 to your computer and use it in GitHub Desktop.
module ActionView
module Helpers
class FormBuilder
module FormBuilderExtension
def hint(method, text)
errors = object.errors.on(method)
hint_message = "<span class='hint'>#{text}</span>"
if errors.blank?
hint_message
else
error_message_on(method, "<span class='explanation'>", "</span>#{hint_message}", 'errorHint')
end
end
end
include FormBuilderExtension
end
end
end
.errorHint .hint { display: none; }
.errorHint:hover .explanation { display: none; }
.errorHint:hover .hint { display: block; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment