summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-02 15:13:52 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-02 15:13:52 +0200
commit175b408948e601d3db568768a309eed8f2edb307 (patch)
treeeef1106f7fb857d26d08aa7fb9055d3c25ad207e /app/helpers
parent9a3274345dc83096a9bdea612ec77cb2406fef21 (diff)
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)
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/content_helper.rb16
1 files changed, 16 insertions, 0 deletions
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
23 ) 23 )
24 end 24 end
25 25
26 def open_erfas_today
27 occurrences = Occurrence
28 .find_in_range(Time.now.beginning_of_day, Time.now.end_of_day)
29 .joins(event: :tags)
30 .where(tags: { name: 'open-day' })
31 .reject { |o| o.node.nil? || o.node.head.nil? }
32 .sample(3)
33
34 return if occurrences.empty?
35
36 render(
37 :partial => 'content/open_erfas_today',
38 :locals => { :occurrences => occurrences }
39 )
40 end
41
26 def tags 42 def tags
27 render :partial => 'content/tags' 43 render :partial => 'content/tags'
28 end 44 end