noesya/osuny

View on GitHub
app/views/admin/communication/blocks/templates/persons/_show.html.erb

Summary

Maintainability
Test Coverage
<% heading_level = block.heading_rank_children %>

<div class="<%= block_html_class(block) %>">
  <div class="container">
    <div class="block-content">
      <%= render 'admin/communication/blocks/partials/top', block: block %>

      <div class="persons">
        <% block.template.selected_elements.each do |element|
          person = element.person
          next if person.nil?
          person_l10n = person.localization_for(block.language)
          next if person_l10n.nil?
          if @website.present?
            person_link = person_l10n.current_permalink_url_in_website(@website)
          elsif current_extranet.present?
            person_link = contacts_person_url(person)
          else
            person_link = '#'
          end
          %>
          <article class="person" itemscope itemtype="https://schema.org/Person">
            <div class="description">
              <h<%= heading_level %>>
                <%= link_to_if block.template.option_link, person_l10n, person_link %>
              </h<%= heading_level %>>
              <p itemprop="jobTitle">
                <%= element.role %>
              </p>
            </div>
            <% if block.template.option_image %>
              <div class="avatar" itemprop="image">
                <% if person.best_picture.attached? %>
                  <%= kamifusen_tag person.best_picture, class: 'img-fluid rounded-circle' %>
                <% end %>
              </div>
            <% end %>
          </article>
        <% end %>
      </div>

    </div>
  </div>
</div>