From 9c92b4ca450efabeedd6bbd37a6af9b423f649ac Mon Sep 17 00:00:00 2001 From: redfast00 Date: Mon, 17 Feb 2020 00:32:23 +0100 Subject: [PATCH] Fix correct front-page order of events --- content/index.erb | 4 ++-- lib/helpers/events.rb | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/content/index.erb b/content/index.erb index e341792..7cd0566 100644 --- a/content/index.erb +++ b/content/index.erb @@ -17,7 +17,7 @@ <%= if studytime? then render '/tiles/blokmap.*'end %>
- <%= render '/partials/_events_tile.*', event: upcoming_events[0] || all_events[-1] %> + <%= render '/partials/_events_tile.*', event: front_page_events[0] %>
@@ -44,7 +44,7 @@
- <% all_events.reject { |x| x == (upcoming_events[0] || all_events[-1]) }.reverse[0..2].each do |event| %> + <% front_page_events[1..3].each do |event| %>
<%= render '/partials/_events_tile.*', event: event %>
diff --git a/lib/helpers/events.rb b/lib/helpers/events.rb index 7e682dd..520f7c0 100644 --- a/lib/helpers/events.rb +++ b/lib/helpers/events.rb @@ -33,6 +33,10 @@ module EventsHelper @items.find_all('/events/*/*/main.md') end + def front_page_events + upcoming_events + all_events.reverse + end + def sub_events(grouped_event) if grouped_event.identifier =~ /main.md/ query = grouped_event.identifier.to_s.split('/')[0..-2].join('/') + '/*'