On Jan 8, 2011, at 8:38 PM, Spiralis wrote:
> The app I am currently working on is private and hence does not need the
> protection from email-scraping that public apps need.
>
> I thought that I could override all the EmailAddress views by doing the
> following in application.dryml:
> <def tag="view" for="EmailAddress"><%= "<a
> href=\"mailto:#{this}\">#{this}</a>".html_safe %></def>
> But, it seems like the tag-definition is ignored somehow. It just keeps using
> the EmailAddress defined in the to_html method in hobo_fields. I used the
> above trick when redefining date-view, but - it seems EmailAddress needs
> something else. Any suggestions?
I believe the EmailAddress class is actually declared in the HoboFields module,
so the type condition above isn't catching it. Note that you can also refer to
field types by the name they're registered under, so this should work:
<def tag="view" for="email_address">
<% if logged_in? %>
<%= mail_to this %>
<% else %>
<%= mail_to this, 'contact via email',:encode => :javascript %>
<% end %>
</def>
This is from a live 1.0 app, so if it doesn't work there's a bug.
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.