diff options
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/content_helper.rb | 16 |
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 |
