summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-21 21:34:14 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-21 21:34:14 +0200
commitec8329069d36cc6aa444c8a48b6b34a3e8f5c9d2 (patch)
tree8a94a94984c0ff20cb3e6dcf12ee212fc98a9ae0 /app/helpers
parent5b951f012e04e6ef97e4ef645d53bdf433a9eb7f (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/helpers')
-rw-r--r--app/helpers/content_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb
index b3c6bad1..459d9e01 100644
--- a/app/helpers/content_helper.rb
+++ b/app/helpers/content_helper.rb
@@ -53,7 +53,7 @@ module ContentHelper
53 end 53 end
54 54
55 def headline_image 55 def headline_image
56 @headline_asset = @page.related_assets.find_by(headline: true)&.asset 56 @headline_asset = @page.headline_asset
57 render :partial => 'content/headline_image' if @headline_asset || @page.assets.images.any? 57 render :partial => 'content/headline_image' if @headline_asset || @page.assets.images.any?
58 end 58 end
59 59