Module: Nlpcaptcha::ClientHelper
- Defined in:
- lib/nlpcaptcha/client_helper.rb
Instance Method Summary collapse
-
#nlpcaptcha_tags(options = {}) ⇒ Object
Your public API can be specified in the
options
hash or preferably using the Configuration.
Instance Method Details
#nlpcaptcha_tags(options = {}) ⇒ Object
Your public API can be specified in the options
hash or preferably using the Configuration.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/nlpcaptcha/client_helper.rb', line 5 def ( = {}) # Default options key = [:publisher_key] ||= Nlpcaptcha.configuration.publisher_key raise NlpcaptchaError, "No publisher key specified." unless key error = [:error] ||= (defined? flash ? flash[:nlpcaptcha_error] : "") uri = Nlpcaptcha.configuration.js_url html = "" html << "\n<script type=\"text/javascript\"> var NLPOptions = {key:'\#{key}'};</script>\n<script type=\"text/javascript\" src=\"\#{uri}\" ></script>\n\n" return (html.respond_to?(:html_safe) && html.html_safe) || html end |