diff --git a/.gitignore b/.gitignore index 7d6158b..ac8193e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ config/*.sphinx.conf config/initializers/development_mail.rb db/sphinx public/assets +.DS_Store +._* diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4b7cd3f..203bad4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -57,4 +57,12 @@ def field(f, attribute, options = {}) type = options.delete(:type) || :text_field content_tag(:div, (f.label(attribute, label_name) + f.send(type, attribute, options)), :class => "field") end + + def encrypt_email(email_address) + email_address.chars.map{|c|c.ord} + end + + def encrypt_mailto_link(email_address) + "".html_safe + end end diff --git a/app/views/feedback_messages/new.html.erb b/app/views/feedback_messages/new.html.erb index ba9a300..c857af8 100644 --- a/app/views/feedback_messages/new.html.erb +++ b/app/views/feedback_messages/new.html.erb @@ -6,9 +6,7 @@ <%= form_for @feedback_message do |f| %> <%= f.error_messages %>
You can also contact @railscasts on Twitter, or send an email to .
+You can also contact @railscasts on Twitter, or send an email to <%= encrypt_mailto_linK("feedback@addoncasts.com")%>.
If you have any comments, suggestions, questions, etc. I'd love to hear them! Please use the <%= link_to "Feedback Page", feedback_path %> or send an email to .
+If you have any comments, suggestions, questions, etc. I'd love to hear them! Please use the <%= link_to "Feedback Page", feedback_path %> or send an email to <%= encrypt_mailto_link("feedback@railscasts.com") %>.
Thank you to all moderators who help keep the site clean and up to date:
diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 5e6bb89..1f5948a 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1,3 +1,16 @@ +function decrypted_email(riddle) { + var email_address = ''; + for ( var i = 0; i < riddle.length; i++ ) { + email_address += String.fromCharCode(riddle[i]) + } + return email_address +} + +function decrypted_mailto_link(riddle) { + var email_address = decrypted_email(riddle) + document.write(""+email_address+"") +} + $(function() { if ($("#episode").length > 0) { sublimevideo.ready(function() { diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb new file mode 100644 index 0000000..10c2734 --- /dev/null +++ b/spec/helpers/application_helper_spec.rb @@ -0,0 +1,7 @@ +require File.dirname(__FILE__) + '/../spec_helper' + +describe ApplicationHelper do + it "encrypts an email address" do + helper.encrypt_email('foo@bar.com').should eq([102, 111, 111, 64, 98, 97, 114, 46, 99, 111, 109]) + end +end