2010-01-09 15:05:02 +00:00
|
|
|
module SimpleForm
|
|
|
|
module Components
|
2011-12-04 14:49:57 +00:00
|
|
|
# Needs to be enabled in order to do automatic lookups.
|
2010-01-09 15:05:02 +00:00
|
|
|
module Hints
|
2014-03-11 22:53:29 +00:00
|
|
|
def hint(wrapper_options = nil)
|
2012-01-11 20:12:49 +00:00
|
|
|
@hint ||= begin
|
|
|
|
hint = options[:hint]
|
2013-11-27 01:33:24 +00:00
|
|
|
|
|
|
|
if hint.is_a?(String)
|
|
|
|
html_escape(hint)
|
|
|
|
else
|
2014-04-04 17:43:22 +00:00
|
|
|
content = translate_from_namespace(:hints)
|
2013-11-27 01:33:24 +00:00
|
|
|
content.html_safe if content
|
|
|
|
end
|
2011-12-04 14:49:57 +00:00
|
|
|
end
|
2011-09-03 10:55:53 +00:00
|
|
|
end
|
2012-01-10 21:00:14 +00:00
|
|
|
|
|
|
|
def has_hint?
|
2012-10-26 03:47:39 +00:00
|
|
|
options[:hint] != false && hint.present?
|
2012-01-10 21:00:14 +00:00
|
|
|
end
|
2010-01-09 15:05:02 +00:00
|
|
|
end
|
|
|
|
end
|
2010-09-22 18:45:22 +00:00
|
|
|
end
|