diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-21 21:34:14 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-21 21:34:14 +0200 |
| commit | ec8329069d36cc6aa444c8a48b6b34a3e8f5c9d2 (patch) | |
| tree | 8a94a94984c0ff20cb3e6dcf12ee212fc98a9ae0 /app/views/custom/partials/_chapter.html.erb | |
| parent | 5b951f012e04e6ef97e4ef645d53bdf433a9eb7f (diff) | |
Extract Page#headline_asset
The same related_assets.find_by(headline: true) query was written by
hand in three places -- content_helper, nodes#show, and the chapter
teaser partial (which was still using assets.first, the old
position-based rule, until now). Collapsed to one method, one query.
Diffstat (limited to 'app/views/custom/partials/_chapter.html.erb')
| -rw-r--r-- | app/views/custom/partials/_chapter.html.erb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/views/custom/partials/_chapter.html.erb b/app/views/custom/partials/_chapter.html.erb index 47f3950c..5d47679e 100644 --- a/app/views/custom/partials/_chapter.html.erb +++ b/app/views/custom/partials/_chapter.html.erb | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | <div class="article_partial chapter_partial" lang="<%= page.effective_lang %>"> | 1 | <div class="article_partial chapter_partial" lang="<%= page.effective_lang %>"> |
| 2 | <div class="chapter_partial_layout"> | 2 | <div class="chapter_partial_layout"> |
| 3 | <% if page.assets.images.any? %> | 3 | <% if page.headline_asset %> |
| 4 | <%= link_to_path image_tag(page.assets.images.first.upload.url(:thumb), :alt => ""), page.node.unique_name, class: "chapter_thumbnail" %> | 4 | <%= link_to_path image_tag(page.headline_asset.upload.url(:thumb), :alt => ""), page.node.unique_name, class: "chapter_thumbnail" %> |
| 5 | <% end %> | 5 | <% end %> |
| 6 | <div class="chapter_partial_content"> | 6 | <div class="chapter_partial_content"> |
| 7 | <h2 class="headline"><%= link_to_path page.title, page.node.unique_name %></h2> | 7 | <h2 class="headline"><%= link_to_path page.title, page.node.unique_name %></h2> |
