GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: ReCaptcha helpers for Rails apps
Homepage: http://ambethia.com/recaptcha
Clone URL: git://github.com/ambethia/recaptcha.git
enhancement for using recaptcha ajax api
Evan Wheeler (author)
Tue Jul 01 15:02:01 -0700 2008
commit  045e10b0224deed6f9242910edf922a23dbb0751
tree    11d1e1157fb4cdc1a99562c814369737fb39fab4
parent  8cdc6be8470a6ca9a1d01ac4a391d33d408fd716
...
19
20
21
22
23
24
25
26
27
28
29
30
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
33
34
...
19
20
21
 
 
 
 
 
 
 
 
 
 
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
0
@@ -19,16 +19,24 @@ module Ambethia
0
         if options[:display]
0
           xhtml.script(:type => "text/javascript"){ xhtml.text! "var RecaptchaOptions = #{options[:display].to_json};\n"}
0
         end
0
- xhtml.script(:type => "text/javascript", :src => "#{uri}/challenge?k=#{key}&error=#{error}") {}
0
- unless options[:noscript] == false
0
- xhtml.noscript do
0
- xhtml.iframe(:src => "#{uri}/noscript?k=#{key}",
0
- :height => options[:iframe_height] ||= 300,
0
- :width => options[:iframe_width] ||= 500,
0
- :frameborder => 0) {}; xhtml.br
0
- xhtml.textarea(:name => "recaptcha_challenge_field", :rows => 3, :cols => 40) {}
0
- xhtml.input :name => "recaptcha_response_field",
0
- :type => "hidden", :value => "manual_challenge"
0
+ if options[:ajax]
0
+ xhtml.div(:id => 'dynamic_recaptcha') {}
0
+ xhtml.script(:type => "text/javascript", :src => "#{uri}/js/recaptcha_ajax.js") {}
0
+ xhtml.script(:type => "text/javascript") do
0
+ xhtml.text! "Recaptcha.create('#{key}', document.getElementById('dynamic_recaptcha') );"
0
+ end
0
+ else
0
+ xhtml.script(:type => "text/javascript", :src => "#{uri}/challenge?k=#{key}&error=#{error}") {}
0
+ unless options[:noscript] == false
0
+ xhtml.noscript do
0
+ xhtml.iframe(:src => "#{uri}/noscript?k=#{key}",
0
+ :height => options[:iframe_height] ||= 300,
0
+ :width => options[:iframe_width] ||= 500,
0
+ :frameborder => 0) {}; xhtml.br
0
+ xhtml.textarea(:name => "recaptcha_challenge_field", :rows => 3, :cols => 40) {}
0
+ xhtml.input :name => "recaptcha_response_field",
0
+ :type => "hidden", :value => "manual_challenge"
0
+ end
0
           end
0
         end
0
         raise ReCaptchaError, "No public key specified." unless key

Comments

    No one has commented yet.