<% author_count = category.articles.published.order(position: :asc).map(&:author).uniq.size %> <% if author_count > 0 %>
<% category.articles.published.order(position: :asc).map(&:author).uniq.take(3).each do |author| %> <%= render "public/api/v1/portals/thumbnail", author: author, size: 5 %> <% end %>
<% first_author = category.articles.published.order(position: :asc).map(&:author).uniq.first&.name || '' %> <% author_text = author_count > 1 ? "#{author_count} #{I18n.t('public_portal.common.authors')}" : "#{author_count} #{I18n.t('public_portal.common.author')}" %> <% other_authors_count = author_count - 1 %> <% other_authors_text = other_authors_count > 1 ? I18n.t('public_portal.common.others') : I18n.t('public_portal.common.other') %> <% if show_expanded %> <%= "#{I18n.t('public_portal.common.by')} #{first_author}" %> <%= other_authors_count.positive? ? " and #{other_authors_count} #{other_authors_text}" : '' %> <% else %> <%= author_text %> <% end %>
<% end %>