zeus.ugent.be/layouts/eventpost.erb

166 lines
5.6 KiB
Text
Raw Normal View History

2016-07-18 11:06:45 +02:00
<% content_for :head do %>
2017-05-01 23:47:53 +02:00
<% if item[:image] %>
<meta property="og:image" content="<%= item[:image] %>" />
2017-05-01 23:47:53 +02:00
<% end %>
2016-07-18 11:15:03 +02:00
<meta property="og:title" content="<%= item[:title] %>" />
2016-07-19 13:55:27 +02:00
<meta property="og:type" content="article" />
<meta property="og:url" content="<%= url_for(item) %>" />
2016-10-10 19:16:08 +02:00
<meta property="og:description" content="<%= item[:description] %>" />
<meta property="og:site_name" content="Zeus WPI" />
2017-05-01 23:47:53 +02:00
<meta name="twitter:label1" value="Time" />
<meta name="twitter:data1" value="<%= item[:time].strftime '%A %d %B %Y %H:%M' %>" />
<meta name="twitter:label2" value="Place" />
<meta name="twitter:data2" value="<%= item[:location] %>" />
2016-10-10 19:16:08 +02:00
<meta name="twitter:card" content="summary_large_image" />
2018-08-28 21:59:17 +02:00
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.3.4/dist/leaflet.js"></script>
2016-07-18 11:06:45 +02:00
<% end %>
<% if item[:banner] %>
2016-10-10 13:59:06 +02:00
<section class="hero is-medium is-primary is-bold" style="background-image:url('<%= item[:banner] %>');background-position:center;">
<% elsif item[:color] %>
<% gradient = if item[:gradient].nil? || item[:gradient]
2018-04-23 13:08:20 +02:00
'linear-gradient(141deg,rgba(255,255,255,0),rgba(0,0,0,.60))'
else
'none'
end %>
<section class="hero is-medium is-primary is-bold" style="background-image: <%= gradient %>; background-color:<%= item[:color] %>;">
<% else %>
2016-10-03 20:52:01 +02:00
<section class="hero is-medium is-primary is-bold">
<% end %>
2016-07-27 20:27:28 +02:00
<div class="hero-head">
<%= render '/partials/_navbar.*', zeus_logo_color: :white, transparent_nav: true %>
2016-07-12 23:58:08 +02:00
</div>
2016-10-03 19:21:29 +02:00
<div class="hero-body">
2016-07-27 20:27:28 +02:00
<div class="container">
2016-09-13 17:13:43 +02:00
<div class="columns">
<div class="column has-vertical-center">
<div class="header-text <%= item[:header_text_background] ? 'light-background' : '' %>">
2017-04-23 12:46:47 +02:00
<p class="title is-1-responsive event-title">
<b>
<%= item[:title] %>
</b>
<span class="event-social-icons">
<% if item[:facebook] %>
<a href="<%= item[:facebook] %>">
<%= fa :facebook %>
</a>
<% end %>
<a href="<%= item.path rep: :ical %>">
<%= fa :calendar %>
</a>
</span>
</p>
2017-04-23 12:46:47 +02:00
<p class="subtitle is-3-responsive">
<%= item[:description] %>
</p>
2017-04-23 12:46:47 +02:00
<ul class="fa-ul is-4-responsive">
2017-04-21 14:37:31 +02:00
<li><%= fa 'clock-o', li: true %><%= item[:time].strftime '%A %d %B %Y %H:%M' %></li>
<li><%= fa 'map-marker', li: true %><%= item[:location] %></li>
</ul>
</div>
2016-09-13 17:13:43 +02:00
</div>
2017-04-21 14:37:31 +02:00
<% if item[:image] %>
2016-09-13 17:13:43 +02:00
<div class="is-narrow column banner-image">
2017-04-21 14:37:31 +02:00
<img src="<%= item[:image] %>" alt="banner">
2016-09-13 17:13:43 +02:00
</div>
2017-04-21 14:37:31 +02:00
<% end %>
2016-09-13 17:13:43 +02:00
</div>
2016-07-27 20:27:28 +02:00
</div>
</div>
</section>
<section class="section">
<div class="columns">
2016-08-27 20:15:00 +02:00
<div class="column is-8 is-offset-2">
2017-04-23 12:46:47 +02:00
<div class="content has-text-justified is-medium-responsive">
2016-07-28 17:56:33 +02:00
<%= yield %>
</div>
2017-10-21 11:49:28 +02:00
2018-08-28 21:59:17 +02:00
<!-- MAPS -->
2017-12-16 18:49:56 +01:00
<div class="map-wrapper box">
2018-08-28 21:59:17 +02:00
<div id="map-error" class="is-invisible" style="height:100%;width:100%;position:absolute;left:0;top:0;background-color:#00000066;z-index:1000;color:white;font-size:30px;display:flex;justify-content:center;align-items:center;padding:50px;">
Could not find location. Please create an issue on github.
</div>
<div id="map" style="height:100%;"></div>
2017-12-16 18:49:56 +01:00
</div>
2017-10-21 11:49:28 +02:00
</div>
</div>
</section>
2018-08-28 21:59:17 +02:00
<script>
var map = L.map('map');
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
function performRequest(url, success_callback) {
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.onload = function() {
if (this.status >= 200 && this.status < 400) {
// Success!
var data = JSON.parse(this.response);
success_callback(data);
} else {
// We reached our target server, but it returned an error
}
};
request.onerror = function() {
// There was a connection error of some sort
};
request.send();
}
2018-08-28 22:15:13 +02:00
performRequest("https://photon.komoot.de/api/?limit=1&q=<%= URI::encode(item[:locationlink]) %>", function(data) {
2018-08-28 21:59:17 +02:00
var lat, lon;
if(data.features.length < 1) {
lat = 51.0538286;
lon = 3.7250121;
var className = 'is-invisible';
var el = document.getElementById('map-error');
if (el.classList)
el.classList.remove(className);
else
el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
} else {
var place = data.features[0].properties;
lat = data.features[0].geometry.coordinates[1];
lon = data.features[0].geometry.coordinates[0];
L.marker([lat, lon]).addTo(map)
.bindPopup(place.name + ', ' + place.street + ' ' + place.housenumber)
.openPopup();
}
map.setView([lat, lon], 18);
});
</script>
2017-10-21 11:49:28 +02:00
<!-- SPONSORED BY -->
<% if item[:sponsors] %>
<section class="section">
<div class="columns">
<div class="column is-8 is-offset-2">
<h1 class="title is-1-responsive has-text-centered">Sponsored by</h1>
2017-10-21 11:49:28 +02:00
<div class="sponsors">
<% @item[:sponsors].each do |sp| %>
<a href="<%= sp[:url] %>" target="_blank">
<img src="<%= sp[:img] %>" alt="<%= sp[:name] %>">
</a>
<% end %>
</div>
2016-09-02 00:05:38 +02:00
</div>
</div>
2016-07-27 20:27:28 +02:00
</section>
2017-10-21 11:49:28 +02:00
<% end %>
<!-- END SPONSORED BY -->