Fix correct front-page order of events

This commit is contained in:
redfast00 2020-02-17 00:32:23 +01:00
parent 57d20dddea
commit 9c92b4ca45
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C
2 changed files with 6 additions and 2 deletions

View file

@ -17,7 +17,7 @@
<%= if studytime? then render '/tiles/blokmap.*'end %>
<!--next event -->
<div class="tile is-parent">
<%= render '/partials/_events_tile.*', event: upcoming_events[0] || all_events[-1] %>
<%= render '/partials/_events_tile.*', event: front_page_events[0] %>
</div>
<div class="tile">
<!--top coders -->
@ -44,7 +44,7 @@
</div>
<div class="tile">
<div class="tile is-vertical">
<% 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| %>
<div class="tile is-parent ">
<%= render '/partials/_events_tile.*', event: event %>
</div>

View file

@ -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('/') + '/*'