Merge pull request #68 from mlucouss/vereniging-mailto
Detect if contact is an email and generate mailto
This commit is contained in:
commit
f76411c574
2 changed files with 5 additions and 1 deletions
|
@ -16,7 +16,7 @@
|
|||
<%if item[:deelname_link] || item[:contact] || item[:website]%>
|
||||
<% if item[:deelname_link] %><a href="<%= item[:deelname_link] %>"><%= item[:deelname_link] %></a><% end %>
|
||||
<div class="contact-container">
|
||||
<% if item[:contact] %><a href="<%= item[:contact] %>"><%= item[:contact] %></a><%end%>
|
||||
<% if item[:contact] %><a href="<%= "mailto:" if is_email item[:contact] %><%= item[:contact] %>"><%= item[:contact] %></a><%end%>
|
||||
<% if item[:website] %><a href="<%= item[:website] %>"><%= item[:website] %></a><%end%>
|
||||
</div><%end%>
|
||||
<% if item[:social] %>
|
||||
|
|
|
@ -84,4 +84,8 @@ module VerenigingenHelper
|
|||
def image_tag(item)
|
||||
"<img src='#{ image_url item }' alt='#{ item[:naam] } logo' />"
|
||||
end
|
||||
|
||||
def is_email(item)
|
||||
item.match URI::MailTo::EMAIL_REGEXP
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue