Module: Card::Set::All::Recaptcha::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod032-recaptcha/all/recaptcha.rb
Instance Method Summary collapse
-
#card_form_html_opts(action, opts = {}) ⇒ Object
-
#hidden_form_tags(action, opts) ⇒ Object
-
#recaptcha?(opts) ⇒ Boolean
-
#recaptcha_script_url ⇒ Object
-
#recaptcha_token(action) ⇒ Object
Instance Method Details
#card_form_html_opts(action, opts = {}) ⇒ Object
102 103 104 105 106 |
# File 'platypus/tmp/set/gem-defaults/mod032-recaptcha/all/recaptcha.rb', line 102 def card_form_html_opts action, opts={} super opts["data-recaptcha"] ||= "on" if recaptcha?(opts) opts end |
#hidden_form_tags(action, opts) ⇒ Object
96 97 98 99 100 |
# File 'platypus/tmp/set/gem-defaults/mod032-recaptcha/all/recaptcha.rb', line 96 def action, opts return super unless recaptcha?(opts) super + recaptcha_token(action) end |
#recaptcha?(opts) ⇒ Boolean
108 109 110 |
# File 'platypus/tmp/set/gem-defaults/mod032-recaptcha/all/recaptcha.rb', line 108 def recaptcha? opts card.recaptcha_on? && opts[:recaptcha] != :off end |
#recaptcha_script_url ⇒ Object
92 93 94 |
# File 'platypus/tmp/set/gem-defaults/mod032-recaptcha/all/recaptcha.rb', line 92 def recaptcha_script_url "https://www.google.com/recaptcha/api.js?render=#{Card.config.recaptcha_site_key}" end |
#recaptcha_token(action) ⇒ Object
82 83 84 85 86 87 88 89 90 |
# File 'platypus/tmp/set/gem-defaults/mod032-recaptcha/all/recaptcha.rb', line 82 def recaptcha_token action output [ javascript_include_tag(recaptcha_script_url), hidden_field_tag("recaptcha_token", "", "data-site-key": Card.config.recaptcha_site_key, "data-action": action, class: "_recaptcha-token") ] end |