Commit 72311d9d30913269be0dbb5966c3bf5bf6b70e34

Authored by Antonio Terceiro
1 parent 8f785987

ActionItem1041: obfuscating e-mail address (sort of)

app/helpers/application_helper.rb
@@ -878,4 +878,8 @@ module ApplicationHelper @@ -878,4 +878,8 @@ module ApplicationHelper
878 render :file => 'shared/noosfero_layout_features' 878 render :file => 'shared/noosfero_layout_features'
879 end 879 end
880 880
  881 + def link_to_email(email)
  882 + javascript_tag('var array = ' + email.split('@').to_json + '; document.write("<a href=\'mailto:" + array.join("@") + "\'>" + array.join("@") + "</a>")')
  883 + end
  884 +
881 end 885 end
app/views/profile/_person.rhtml
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 <%= display_field(_('Address:'), profile, :address) %> 12 <%= display_field(_('Address:'), profile, :address) %>
13 <%= display_field(_('ZIP code:'), profile, :zip_code) %> 13 <%= display_field(_('ZIP code:'), profile, :zip_code) %>
14 <%= display_field(_('Contact phone:'), profile, :contact_phone) %> 14 <%= display_field(_('Contact phone:'), profile, :contact_phone) %>
15 - <%= display_field(_('e-Mail:'), profile, :email) { |email| link_to email, 'mailto:'+email } %> 15 + <%= display_field(_('e-Mail:'), profile, :email) { |email| link_to_email(email) } %>
16 <% end %> 16 <% end %>
17 <%= display_field(_('Location:'), profile, :location) %> 17 <%= display_field(_('Location:'), profile, :location) %>
18 18