docbrown/app/views/articles/_bottom_content.html.erb
Joshua Wehner e63423573c
Misc/minor article fixes (#18846)
* Don't assume all requests are JSON

* Prevent nil error from optimized_image_tag (possible local data issue)

* Slug miss should 404, instead of Podcast not found

* Plain html rescue satisfies spec(s)
2022-12-13 15:15:09 +01:00

24 lines
1.3 KiB
Text

<% if articles && articles.any? %>
<section class="crayons-card crayons-card--secondary text-padding mb-4 print-hidden" id="bottom-content-read-next">
<h2 class="crayons-subtitle-1"><%= t("views.articles.read_next") %></h2>
<% articles.each do |article| %>
<a href="<%= article.path %>" data-preload-image="<%= cloud_cover_url(article.main_image) %>" class="crayons-link mt-6 block">
<div class="flex items-center">
<span class="crayons-avatar crayons-avatar--xl m:crayons-avatar--2xl mr-4 shrink-0">
<% if article.cached_user.profile_image_url %>
<%= optimized_image_tag(article.cached_user.profile_image_url,
optimizer_options: { crop: "imagga_scale", width: 100, height: 100 },
image_options: { loading: "lazy", alt: "#{article.cached_user.username} profile image", class: "crayons-avatar__image" }) %>
<% end %>
</span>
<div>
<h3 class="fs-xl mb-0 lh-tight"><%= article.title %></h3>
<p class="opacity-75 pt-1">
<%= article.cached_user.name %> - <time datetime="<%= article.published_timestamp %>"><%= article.readable_publish_date %></time>
</p>
</div>
</div>
</a>
<% end %>
</section>
<% end %>