<p class="contact-intro">If you wish to speak to someone about this information, please <span class="call-to-action">contact:</span></p>

<div class="contact">
  <dl>
    <% if (name = contact.name).present? %>
      <dt>Name:</dt>
      <dd><%= name %></dd>
    <% end %>
    <% if (postal_address = contact.postal_address).present? %>
      <dt>Postal address:</dt>
      <dd><%= format_postal_address postal_address %></dd>
    <% end %>
    <% if (email_address = contact.email_address).present? %>
      <dt>Email address:</dt>
      <dd><%= format_email_address email_address %></dd>
    <% end %>
    <% if (website_url = contact.website_url).present? %>
      <dt>Website URL:</dt>
      <dd><%= format_website_url website_url %></dd>
    <% end %>
    <% if (opening_hours = contact.opening_hours).present? %>
      <dt>Opening hours:</dt>
      <dd><%= format_opening_hours opening_hours %></dd>
    <% end %>
  </dl>
</div>

<p class="contact-intro">If you wish to speak to someone about this information, please <span class="call-to-action">contact:</span></p>

<div class="contact">
  <dl>
    <% if (name = contact.name).present? %>
      <dt>Name:</dt>
      <dd><%= name %></dd>
    <% end %>
    <% if (postal_address = contact.postal_address).present? %>
      <dt>Postal address:</dt>
      <dd><%= format_postal_address postal_address %></dd>
    <% end %>
    <% if (email_address = contact.email_address).present? %>
      <dt>Email address:</dt>
      <dd><%= format_email_address email_address %></dd>
    <% end %>
    <% if (website_url = contact.website_url).present? %>
      <dt>Website URL:</dt>
      <dd><%= format_website_url website_url %></dd>
    <% end %>
    <% if (opening_hours = contact.opening_hours).present? %>
      <dt>Opening hours:</dt>
      <dd><%= format_opening_hours opening_hours %></dd>
    <% end %>
  </dl>
</div>

<%= javascript_tag do %>
  $(function () {
    var metadata = $('.meta-data');
    var contact = metadata.find('.contact').remove();
    metadata.find('.contact-intro .call-to-action')
      .after('.')
      .replaceWith(
        $('<a>', {
          text: 'click here for contact details',
          href: '#contact',
          click: function (event) {
            event.preventDefault();
            BetaPopup.popup(contact);
          }
        })
      );
  });
<% end %>

Use JavaScript to hide contact details and show in lightbox on click
Use JavaScript to hide contact details and show in lightbox on click
