From 6b302d263ac66b521a743f1e8e1cc82997b54b5d Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 14 Jul 2026 04:25:14 +0200 Subject: Add chapter images: thumbnail on the list, headline image on the detail page _chapter.html.erb (the aggregator partial used by the erfas/ chaostreffs overview pages) never rendered an image at all -- editors attaching a hackerspace photo via the asset picker would see zero visible effect on exactly the pages they'd check first. chapter_detail.html.erb (the individual page template) had the same gap. Both fixed by reusing existing infrastructure rather than inventing anything: the overview list gets a small, aspect-preserving :thumb image beside the heading; the detail page gets the app's existing headline_image helper, the same one every other full-page template already uses. --- .../page_templates/public/chapter_detail.html.erb | 1 + app/views/custom/partials/_chapter.html.erb | 37 +++++++++++++--------- 2 files changed, 23 insertions(+), 15 deletions(-) (limited to 'app/views/custom') diff --git a/app/views/custom/page_templates/public/chapter_detail.html.erb b/app/views/custom/page_templates/public/chapter_detail.html.erb index f47353c4..c4c25982 100644 --- a/app/views/custom/page_templates/public/chapter_detail.html.erb +++ b/app/views/custom/page_templates/public/chapter_detail.html.erb @@ -1,5 +1,6 @@

<%= @page.title %>

+ <%= headline_image %> <% if @page.node.external_url.present? %>
<%= link_to @page.node.external_url, @page.node.external_url, target: '_blank', rel: 'noopener' %>
<% end %> diff --git a/app/views/custom/partials/_chapter.html.erb b/app/views/custom/partials/_chapter.html.erb index 805559b2..47f3950c 100644 --- a/app/views/custom/partials/_chapter.html.erb +++ b/app/views/custom/partials/_chapter.html.erb @@ -1,19 +1,26 @@
-

<%= link_to_path page.title, page.node.unique_name %>

- <% if page.abstract.present? %> -
<%= page.abstract %>
- <% end %> - <% if page.node.external_url.present? %> -
<%= link_to page.node.external_url, page.node.external_url, target: '_blank', rel: 'noopener' %>
- <% end %> - <% open_days = page.node.events.tagged_with('open-day').order(:start_time) %> - <% if open_days.any? %> -
- <%= t(:open_days_label) %>: - <% open_days.each do |event| %> - <%= event_schedule_text(event) %> +
+ <% if page.assets.images.any? %> + <%= link_to_path image_tag(page.assets.images.first.upload.url(:thumb), :alt => ""), page.node.unique_name, class: "chapter_thumbnail" %> + <% end %> +
+

<%= link_to_path page.title, page.node.unique_name %>

+ <% if page.abstract.present? %> +
<%= page.abstract %>
<% end %> + <% if page.node.external_url.present? %> +
<%= link_to page.node.external_url, page.node.external_url, target: '_blank', rel: 'noopener' %>
+ <% end %> + <% open_days = page.node.events.tagged_with('open-day').order(:start_time) %> + <% if open_days.any? %> +
+ <%= t(:open_days_label) %>: + <% open_days.each do |event| %> + <%= event_schedule_text(event) %> + <% end %> +
+ <% end %> +

<%= sanitize page.body %>

- <% end %> -

<%= sanitize page.body %>

+
-- cgit v1.3