From 175b408948e601d3db568768a309eed8f2edb307 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 2 Jul 2026 15:13:52 +0200 Subject: Add 'open today' sidebar widget and open days in chapter lists - open_erfas_today helper: samples 3 random open-day-tagged occurrences of the current day; widget hidden entirely on days without open chapters; heading shows current weekday - content/_open_erfas_today partial rendered in right column above tags and featured articles - _chapter partial: open-day schedules (event_schedule_text) shown inline in aggregated chapter lists with 'Offene Tage' label - ccc.css: open_erfas_today added to existing right-column widget selector groups (headings, lists, links) --- app/helpers/content_helper.rb | 16 ++++++++++++++++ app/views/content/_open_erfas_today.html.erb | 11 +++++++++++ app/views/custom/partials/_chapter.html.erb | 9 +++++++++ app/views/layouts/application.html.erb | 1 + 4 files changed, 37 insertions(+) create mode 100644 app/views/content/_open_erfas_today.html.erb (limited to 'app') diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index 53bf5b2..bf7287f 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -23,6 +23,22 @@ module ContentHelper ) end + def open_erfas_today + occurrences = Occurrence + .find_in_range(Time.now.beginning_of_day, Time.now.end_of_day) + .joins(event: :tags) + .where(tags: { name: 'open-day' }) + .reject { |o| o.node.nil? || o.node.head.nil? } + .sample(3) + + return if occurrences.empty? + + render( + :partial => 'content/open_erfas_today', + :locals => { :occurrences => occurrences } + ) + end + def tags render :partial => 'content/tags' end diff --git a/app/views/content/_open_erfas_today.html.erb b/app/views/content/_open_erfas_today.html.erb new file mode 100644 index 0000000..3448af3 --- /dev/null +++ b/app/views/content/_open_erfas_today.html.erb @@ -0,0 +1,11 @@ +
+

<%= t(:open_today) %>

+ +
diff --git a/app/views/custom/partials/_chapter.html.erb b/app/views/custom/partials/_chapter.html.erb index a5b8662..805559b 100644 --- a/app/views/custom/partials/_chapter.html.erb +++ b/app/views/custom/partials/_chapter.html.erb @@ -6,5 +6,14 @@ <% 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 %>

diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index edab5fc..57d12e6 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -72,6 +72,7 @@
+ <%= open_erfas_today %> <%= tags %> <%= featured_articles %>
-- cgit v1.3