osunyorg/admin

View on GitHub
app/views/extranet/contacts/persons/_details.html.erb

Summary

Maintainability
Test Coverage
<dl>
  <% [:phone_mobile, :phone_personal, :phone_professional].each do |attribute_name| %>
    <% next if person.public_send(attribute_name).blank? || person.public_send("#{attribute_name}_is_private?") %>
    <dt class="fw-normal small"><%= University::Person.human_attribute_name(attribute_name) %></dt>
    <dd>
      <a href="tel:<%= person.public_send(attribute_name) %>" target="_blank" rel="noreferrer">
        <%= person.public_send(attribute_name) %>
      </a>
    </dd>
  <% end %>
  <% if person.email.present? && !person.email_is_private? %>
    <dt class="fw-normal small"><%= University::Person.human_attribute_name(:email) %></dt>
    <dd>
      <a href="mailto:<%= person.email %>" target="_blank" rel="noreferrer">
        <%= person.email %>
      </a>
    </dd>
  <% end %>
  <% if person.full_street_address.present? && !person.address_is_private? %>
    <dt class="fw-normal small"><%= University::Person.human_attribute_name("address") %></dt>
    <dd>
      <%= person.address %>
      <% if person.address.present? && (person.city.present? || person.zipcode.present?) %><br><% end %>
      <%= person.zipcode %>
      <%= person.city %>
    </dd>
  <% end %>
  <% if l10n.url.present? %>
    <dt class="fw-normal small"><%= University::Person::Localization.human_attribute_name(:url) %></dt>
    <dd><%= contact_link l10n.url, :website %></dd>
  <% end %>
  <% if l10n.linkedin.present? && !person.linkedin_is_private? %>
    <dt class="fw-normal small"><%= University::Person::Localization.human_attribute_name(:linkedin) %></dt>
    <dd><%= contact_link l10n.linkedin, :linkedin %></dd>
  <% end %>
  <% if l10n.twitter.present? && !person.twitter_is_private? %>
    <dt class="fw-normal small"><%= University::Person::Localization.human_attribute_name(:twitter) %></dt>
    <dd><%= contact_link l10n.twitter, :twitter %></dd>
  <% end %>
  <% if l10n.mastodon.present? && !person.mastodon_is_private? %>
    <dt class="fw-normal small"><%= University::Person::Localization.human_attribute_name(:mastodon) %></dt>
    <dd><%= contact_link l10n.mastodon, :mastodon %></dd>
  <% end %>
</dl>