diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/helpers/content_helper.rb | 16 | ||||
| -rw-r--r-- | app/views/content/_open_erfas_today.html.erb | 11 | ||||
| -rw-r--r-- | app/views/custom/partials/_chapter.html.erb | 9 | ||||
| -rw-r--r-- | app/views/layouts/application.html.erb | 1 |
4 files changed, 37 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 |
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 @@ | |||
| 1 | <div id="open_erfas_today"> | ||
| 2 | <h2><%= t(:open_today) %></h2> | ||
| 3 | <ul class="teasertext"> | ||
| 4 | <% occurrences.each do |occurrence| %> | ||
| 5 | <li> | ||
| 6 | <%= link_to_path occurrence.node.head.title, occurrence.node.unique_name %> | ||
| 7 | <span class="event_time"><%= occurrence.start_time.strftime("%H:%M") %></span> | ||
| 8 | </li> | ||
| 9 | <% end %> | ||
| 10 | </ul> | ||
| 11 | </div> | ||
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 @@ | |||
| 6 | <% if page.node.external_url.present? %> | 6 | <% if page.node.external_url.present? %> |
| 7 | <div class="chapter_url"><%= link_to page.node.external_url, page.node.external_url, target: '_blank', rel: 'noopener' %></div> | 7 | <div class="chapter_url"><%= link_to page.node.external_url, page.node.external_url, target: '_blank', rel: 'noopener' %></div> |
| 8 | <% end %> | 8 | <% end %> |
| 9 | <% open_days = page.node.events.tagged_with('open-day').order(:start_time) %> | ||
| 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 %> | ||
| 16 | </div> | ||
| 17 | <% end %> | ||
| 9 | <p class="excerpt"><%= sanitize page.body %></p> | 18 | <p class="excerpt"><%= sanitize page.body %></p> |
| 10 | </div> | 19 | </div> |
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 @@ | |||
| 72 | </div> | 72 | </div> |
| 73 | </div> | 73 | </div> |
| 74 | <div id="right_column"> | 74 | <div id="right_column"> |
| 75 | <%= open_erfas_today %> | ||
| 75 | <%= tags %> | 76 | <%= tags %> |
| 76 | <%= featured_articles %> | 77 | <%= featured_articles %> |
| 77 | </div> | 78 | </div> |
