Module: Turnstile::ViewHelpers
- Defined in:
- lib/turnstile/view_helpers.rb
Instance Method Summary collapse
- #captcha_javascript_tag(options = {}) ⇒ Object
- #captcha_placeholder_tag(options = {}) ⇒ Object
- #captcha_tags(options = {}) ⇒ Object
Instance Method Details
#captcha_javascript_tag(options = {}) ⇒ Object
13 14 15 |
# File 'lib/turnstile/view_helpers.rb', line 13 def captcha_javascript_tag( = {}) javascript_include_tag Turnstile.configuration.script_url, **.reverse_merge(async: true, defer: true) end |
#captcha_placeholder_tag(options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/turnstile/view_helpers.rb', line 17 def captcha_placeholder_tag( = {}) action = .delete(:action) attrs = { class: "cf-turnstile", data: { action: action, sitekey: Turnstile.configuration.site_key } }.deep_merge() content_tag :div, "", attrs end |
#captcha_tags(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/turnstile/view_helpers.rb', line 4 def ( = {}) = .delete(:javascript_tag) || {} [ captcha_javascript_tag(), captcha_placeholder_tag() ].join.html_safe end |