summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-14 04:25:14 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-14 04:25:14 +0200
commit6b302d263ac66b521a743f1e8e1cc82997b54b5d (patch)
treefd0cb52a9de403628763608d36f6d0778e22ac77
parente0f2394fd0816ef03bf4b928ab9fa5a18c32ffda (diff)
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.
-rw-r--r--app/views/custom/page_templates/public/chapter_detail.html.erb1
-rw-r--r--app/views/custom/partials/_chapter.html.erb37
-rw-r--r--public/stylesheets/ccc.css17
3 files changed, 40 insertions, 15 deletions
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 f47353c..c4c2598 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 @@
1<div class="article" lang="<%= @page.effective_lang %>"> 1<div class="article" lang="<%= @page.effective_lang %>">
2 <h2 class="headline"><%= @page.title %></h2> 2 <h2 class="headline"><%= @page.title %></h2>
3 <%= headline_image %>
3 <% if @page.node.external_url.present? %> 4 <% if @page.node.external_url.present? %>
4 <div class="chapter_url"><%= link_to @page.node.external_url, @page.node.external_url, target: '_blank', rel: 'noopener' %></div> 5 <div class="chapter_url"><%= link_to @page.node.external_url, @page.node.external_url, target: '_blank', rel: 'noopener' %></div>
5 <% end %> 6 <% end %>
diff --git a/app/views/custom/partials/_chapter.html.erb b/app/views/custom/partials/_chapter.html.erb
index 805559b..47f3950 100644
--- a/app/views/custom/partials/_chapter.html.erb
+++ b/app/views/custom/partials/_chapter.html.erb
@@ -1,19 +1,26 @@
1<div class="article_partial chapter_partial" lang="<%= page.effective_lang %>"> 1<div class="article_partial chapter_partial" lang="<%= page.effective_lang %>">
2 <h2 class="headline"><%= link_to_path page.title, page.node.unique_name %></h2> 2 <div class="chapter_partial_layout">
3 <% if page.abstract.present? %> 3 <% if page.assets.images.any? %>
4 <div class="chapter_location"><%= page.abstract %></div> 4 <%= link_to_path image_tag(page.assets.images.first.upload.url(:thumb), :alt => ""), page.node.unique_name, class: "chapter_thumbnail" %>
5 <% end %> 5 <% end %>
6 <% if page.node.external_url.present? %> 6 <div class="chapter_partial_content">
7 <div class="chapter_url"><%= link_to page.node.external_url, page.node.external_url, target: '_blank', rel: 'noopener' %></div> 7 <h2 class="headline"><%= link_to_path page.title, page.node.unique_name %></h2>
8 <% end %> 8 <% if page.abstract.present? %>
9 <% open_days = page.node.events.tagged_with('open-day').order(:start_time) %> 9 <div class="chapter_location"><%= page.abstract %></div>
10 <% if open_days.any? %>
11 <div class="chapter_open_days">
12 <span class="open_days_label"><%= t(:open_days_label) %>: </span>
13 <% open_days.each do |event| %>
14 <span class="event_schedule"><%= event_schedule_text(event) %></span>
15 <% end %> 10 <% end %>
11 <% if page.node.external_url.present? %>
12 <div class="chapter_url"><%= link_to page.node.external_url, page.node.external_url, target: '_blank', rel: 'noopener' %></div>
13 <% end %>
14 <% open_days = page.node.events.tagged_with('open-day').order(:start_time) %>
15 <% if open_days.any? %>
16 <div class="chapter_open_days">
17 <span class="open_days_label"><%= t(:open_days_label) %>: </span>
18 <% open_days.each do |event| %>
19 <span class="event_schedule"><%= event_schedule_text(event) %></span>
20 <% end %>
21 </div>
22 <% end %>
23 <p class="excerpt"><%= sanitize page.body %></p>
16 </div> 24 </div>
17 <% end %> 25 </div>
18 <p class="excerpt"><%= sanitize page.body %></p>
19</div> 26</div>
diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css
index fe2144f..bb4f7e3 100644
--- a/public/stylesheets/ccc.css
+++ b/public/stylesheets/ccc.css
@@ -610,3 +610,20 @@ label[for=light-mode] {
610 } 610 }
611} 611}
612 612
613.chapter_partial_layout {
614 display: flex;
615 gap: 12px;
616 align-items: flex-start;
617}
618
619.chapter_thumbnail img {
620 width: 64px;
621 height: 64px;
622 object-fit: cover;
623 border-radius: 4px;
624 display: block;
625}
626
627.chapter_partial_content {
628 min-width: 0;
629}