noesya/osuny

View on GitHub
app/views/admin/communication/authors/show.html.erb

Summary

Maintainability
Test Coverage
<% content_for :title, @l10n %>

<div class="mb-5">
  <p><%= t('admin.communication.author.show_person_html') %></p>
  <%= link_to t('show'), admin_university_person_path(@author), class: 'action' %>
</div>

<% @author.author_websites.each do |website| %>
  <div class="row mb-5">
    <div class="col-lg-3">
      <%= render 'admin/communication/websites/website', website: website %>
    </div>
    <div class="col-lg-9"
      <%
      total_posts = @author.communication_website_posts.where(website: website)
      recent_posts = total_posts.ordered(current_language).limit(5)
      %>
      <p>
        <%= total_posts.count %>
        <%= Communication::Website::Post.model_name.human(count: total_posts.count).downcase %>
      </p>
      <%= render 'admin/communication/websites/posts/list', posts: recent_posts %>
    </div>
  </div>
<% end  %>

<% @author.author_extranets.each do |extranet| %>
  <div class="row mb-5">
    <div class="col-lg-3">
      <%= render 'admin/communication/extranets/extranet', extranet: extranet %>
    </div>
    <div class="col-lg-9"
      <%
      total_posts = @author.communication_extranet_posts.where(extranet: extranet)
      recent_posts = total_posts.ordered(current_language).limit(5) %>
      <p>
        <%= total_posts.count %>
        <%= Communication::Extranet::Post.model_name.human(count: total_posts.count).downcase %>
      </p>
      <%= render 'admin/communication/extranets/posts/list', posts: recent_posts %>
    </div>
  </div>
<% end  %>