Module: NewGoogleRecaptcha::ViewExt

Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/new_google_recaptcha/view_ext.rb

Instance Method Summary collapse

Instance Method Details

#include_recaptcha_jsObject



5
6
7
# File 'lib/new_google_recaptcha/view_ext.rb', line 5

def include_recaptcha_js
  generate_recaptcha_callback + javascript_include_tag("https://www.google.com/recaptcha/api.js?render=#{NewGoogleRecaptcha.site_key}&onload=newGoogleRecaptchaCallback", defer: true, 'data-turbolinks-track': "reload")
end

#recaptcha_action(action) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/new_google_recaptcha/view_ext.rb', line 9

def recaptcha_action(action)
  id = "new_google_recaptcha_token_#{SecureRandom.hex(10)}"
  hidden_field_tag(
    "new_recaptcha_token",
    nil,
    :readonly => true,
    "data-google-recaptcha-action" => action,
    :id => id
  )
end