Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 470
- Log:
Version 1.0.2 with updated reCaptcha
- Author:
- rool
- Date:
- Sat Apr 16 11:20:56 +0100 2016
- Size:
- 2287 Bytes
1 | module Recaptcha |
2 | module ClientHelper |
3 | # Your public API can be specified in the +options+ hash or preferably |
4 | # using the Configuration. |
5 | def recaptcha_tags(options = {}) |
6 | public_key = options[:public_key] || Recaptcha.configuration.public_key! |
7 | |
8 | script_url = Recaptcha.configuration.api_server_url(options[:ssl]) |
9 | script_url += "?hl=#{options[:hl]}" unless options[:hl].to_s == "" |
10 | fallback_uri = "#{script_url.chomp('.js')}/fallback?k=#{public_key}" |
11 | |
12 | data_attributes = [:theme, :type, :callback, :expired_callback, :size] |
13 | data_attributes = options.each_with_object({}) do |(k, v), a| |
14 | a[k] = v if data_attributes.include?(k) |
15 | end |
16 | data_attributes[:sitekey] = public_key |
17 | data_attributes[:stoken] = Recaptcha::Token.secure_token if options[:stoken] != false |
18 | data_attributes = data_attributes.map { |k,v| %{data-#{k.to_s.tr('_','-')}="#{v}"} }.join(" ") |
19 | |
20 | html = %{<script src="#{script_url}" async defer></script>\n} |
21 | html << %{<div class="g-recaptcha" #{data_attributes}></div>\n} |
22 | |
23 | if options[:noscript] != false |
24 | html << <<-HTML |
25 | <noscript> |
26 | <div style="width: 302px; height: 352px;"> |
27 | <div style="width: 302px; height: 352px; position: relative;"> |
28 | <div style="width: 302px; height: 352px; position: absolute;"> |
29 | <iframe |
30 | src="#{fallback_uri}" |
31 | frameborder="0" scrolling="no" |
32 | style="width: 302px; height:352px; border-style: none;"> |
33 | </iframe> |
34 | </div> |
35 | <div style="width: 250px; height: 80px; position: absolute; border-style: none; |
36 | bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;"> |
37 | <textarea id="g-recaptcha-response" name="g-recaptcha-response" |
38 | class="g-recaptcha-response" |
39 | style="width: 250px; height: 80px; border: 1px solid #c1c1c1; |
40 | margin: 0px; padding: 0px; resize: none;" value=""> |
41 | </textarea> |
42 | </div> |
43 | </div> |
44 | </div> |
45 | </noscript> |
46 | HTML |
47 | end |
48 | |
49 | html.respond_to?(:html_safe) ? html.html_safe : html |
50 | end |
51 | end |
52 | end |