generalize events more

This commit is contained in:
Lorin Werthen 2017-02-16 16:04:00 +01:00
parent b00603ae26
commit 324fb0989c
No known key found for this signature in database
GPG key ID: F11FFC921E0E08E0
3 changed files with 34 additions and 70 deletions

View file

@ -3,59 +3,32 @@ navigable: true
title: Events
order: 20
---
<div>
<div class="container">
<div class="content">
<h1>Upcoming events</h1>
</div>
<div class="container">
<% upcoming_events.each_slice(2) do |slice| %>
<!-- <hr class="divider"> -->
<div class="columns">
<% slice.each do |event| %>
<% if (sub_events(event)).empty? %>
<div class="tile is-parent ">
<%= render '/partials/_events_tile.*',
article: event,
small_text: event[:time].strftime('%A %d %B %Y %H:%M'),
location: event[:location],
color: event[:color] %>
<%= render '/partials/_events_tile.*', event: event %>
</div>
<!-- Render old event_preview when using subevent, for now not used
<% else %>
<% sub_events(event).each do |sub_event| %>
<%= render '/partials/_event_preview.*', event: sub_event, main_event: event %>
<% end %>
<% end %>
-->
<% end %>
</div>
<% end %>
</div>
<div class="container">
<div class="content">
<h1>Past events</h1>
</div>
<% past_events.each_slice(2) do |slice| %>
<!-- <hr class="divider"> -->
<div class="columns">
<% slice.each do |event| %>
<% if (sub_events(event)).empty? %>
<div class="tile is-parent ">
<%= render '/partials/_events_tile.*',
article: event,
small_text: event[:time].strftime('%A %d %B %Y %H:%M'),
location: event[:location],
color: event[:color] %>
<%= render '/partials/_events_tile.*', event: event %>
</div>
<!-- Render old event_preview when using subevent, for now not used
<% else %>
<% sub_events(event).each do |sub_event| %>
<%= render '/partials/_event_preview.*', event: sub_event, main_event: event %>
<% end %>
<% end %>
-->
<% end %>
</div>
<% end %>
</div>

View file

@ -25,9 +25,7 @@
</div>
<!--next event -->
<div class="tile is-parent is-4">
<%= render '/partials/_tile.*',
article: upcoming_events[0] || all_events[-1],
small_text: if upcoming_events[0] then "Upcoming event" else "Past event" end%>
<%= render '/partials/_events_tile.*', event: upcoming_events[0] || all_events[-1] %>
</div>
<!-- latest blogpost -->
@ -42,10 +40,7 @@
<div class="tile is-vertical">
<% all_events.reject { |x| x == upcoming_events[0] }.reverse[0..2].each do |event| %>
<div class="tile is-parent ">
<%= render '/partials/_tile.*',
article: event,
small_text: upcoming_events.include?(event) ? "Upcoming event" : "Past event",
htmlclass:"highlighted" %>
<%= render '/partials/_events_tile.*', event: event %>
</div>
<%end%>
</div>

View file

@ -1,36 +1,32 @@
<% if @article[:banner] %>
<a href="<%= @article.path %>" class="tile is-child box backgroundimg highlighted"
style="background-image:url('<%= @article[:banner] %>');">
<% elsif @article[:color] %>
<a href="<%= @article.path %>" class="tile is-child box backgroundimg highlighted"
style="background-image: linear-gradient(to top right,rgba(255,255,255,0),rgba(0,0,0,.60)); background-color:<%= @article[:color] %>;">
<% if @event[:banner] %>
<a href="<%= @event.path %>" class="tile is-child box backgroundimg highlighted"
style="background-image:url('<%= @event[:banner] %>');">
<% elsif @event[:color] %>
<a href="<%= @event.path %>" class="tile is-child box backgroundimg highlighted"
style="background-image: linear-gradient(to top right,rgba(255,255,255,0),rgba(0,0,0,.60)); background-color:<%= @event[:color] %>;">
<% else %>
<a href="<%= @article.path %>" class="tile is-child box backgroundimg">
<a href="<%= @event.path %>" class="tile is-child box backgroundimg">
<% end %>
<div class="content">
<div class="columns">
<div class="column">
<h2>
<%= @article[:title] %>
<%= @event[:title] %>
</h2>
</div>
<div class="column is-narrow">
<small>
<%= @small_text %>
<%= @event[:time].strftime('%A %d %B %Y %H:%M') %>
<br>
<%= @location %>
<%= @event[:location] %>
</small>
</div>
<div class="column is-narrow">
</div>
</div>
<div class="description">
<%= @article[:description] %>
<%= @event[:description] %>
</div>
<div class="teaser">
<%= get_teaser(@article) %>
<%= get_teaser(@event) %>
</div>
</div>
</a>