summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/helpers/content_helper.rb16
-rw-r--r--app/views/content/_open_erfas_today.html.erb11
-rw-r--r--app/views/custom/partials/_chapter.html.erb9
-rw-r--r--app/views/layouts/application.html.erb1
-rw-r--r--config/locales/de.yml2
-rw-r--r--config/locales/en.yml2
-rw-r--r--public/stylesheets/ccc.css10
7 files changed, 46 insertions, 5 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>
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 9719a1c..e8ae4e1 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -11,7 +11,9 @@ de:
11 event_schedule_unrecognized: "Termin-Regel nicht automatisch lesbar" 11 event_schedule_unrecognized: "Termin-Regel nicht automatisch lesbar"
12 event_schedule_none: "Kein Termin" 12 event_schedule_none: "Kein Termin"
13 open_days: "Offene Tage" 13 open_days: "Offene Tage"
14 open_days_label: "Offene Tage"
14 upcoming_events: "Weitere Termine" 15 upcoming_events: "Weitere Termine"
16 open_today: "Heute dabei"
15 date: 17 date:
16 formats: 18 formats:
17 default: "%d.%m.%Y" 19 default: "%d.%m.%Y"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index aa477f0..980a6b8 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -12,7 +12,9 @@ en:
12 event_schedule_unrecognized: "Schedule not automatically readable" 12 event_schedule_unrecognized: "Schedule not automatically readable"
13 event_schedule_none: "No schedule" 13 event_schedule_none: "No schedule"
14 open_days: "Open days" 14 open_days: "Open days"
15 open_days_label: "Open days"
15 upcoming_events: "Upcoming events" 16 upcoming_events: "Upcoming events"
17 open_today: "Open today"
16 18
17 time: 19 time:
18 formats: 20 formats:
diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css
index 30eb8dd..422b7c0 100644
--- a/public/stylesheets/ccc.css
+++ b/public/stylesheets/ccc.css
@@ -216,7 +216,7 @@ div#frontpage_calendar {
216 } 216 }
217} 217}
218 218
219div#frontpage_calendar h2, div#tags h2, div#featured_articles h2, div.main_navigation h2 { 219div#frontpage_calendar h2, div#tags h2, div#featured_articles h2, div#open_erfas_today h2, div.main_navigation h2 {
220 border-top: 2px solid; 220 border-top: 2px solid;
221 border-bottom: 2px solid; 221 border-bottom: 2px solid;
222 font-size: 1.1em; 222 font-size: 1.1em;
@@ -248,7 +248,7 @@ div#frontpage_calendar h2 {
248} 248}
249 249
250@media(min-width:1016px) { 250@media(min-width:1016px) {
251 div#frontpage_calendar h2, div#tags h2, div#featured_articles h2 { 251 div#frontpage_calendar h2, div#tags h2, div#featured_articles h2, div#open_erfas_today h2 {
252 font-size: 1rem; 252 font-size: 1rem;
253 } 253 }
254 254
@@ -260,7 +260,7 @@ div#frontpage_calendar h2 {
260 260
261} 261}
262 262
263div#frontpage_calendar ul, div#tags ul, div#featured_articles ul { 263div#frontpage_calendar ul, div#tags ul, div#featured_articles ul, div#open_erfas_today ul {
264 padding: 0px; 264 padding: 0px;
265 font-size: 1rem; 265 font-size: 1rem;
266 line-height: 1.5em; 266 line-height: 1.5em;
@@ -278,11 +278,11 @@ div#frontpage_calendar li {
278 margin-bottom: 20px; 278 margin-bottom: 20px;
279} 279}
280 280
281div#frontpage_calendar li, div#tags li, div#featured_articles li { 281div#frontpage_calendar li, div#tags li, div#featured_articles li, div#open_erfas_today li {
282 list-style-type: none; 282 list-style-type: none;
283} 283}
284 284
285div#frontpage_calendar li a, div#tags li a, div#featured_articles li a { 285div#frontpage_calendar li a, div#tags li a, div#featured_articles li a, div#open_erfas_today li a {
286 text-decoration: none; 286 text-decoration: none;
287 color: color-mix(in srgb, CanvasText, #808080 25%); 287 color: color-mix(in srgb, CanvasText, #808080 25%);
288} 288}