Add OSM, fixes #268, fixes #250

This commit is contained in:
Lorin Werthen 2018-08-28 21:59:17 +02:00
parent 0a99f3e05c
commit 81e66bfa5d
No known key found for this signature in database
GPG key ID: F11FFC921E0E08E0
8 changed files with 72 additions and 10 deletions

View file

@ -37,6 +37,7 @@ group :production do
# Autoprefixing for class # Autoprefixing for class
gem 'autoprefixer-rails' gem 'autoprefixer-rails'
gem 'htmlcompressor' gem 'htmlcompressor'
gem 'yui-compressor'
end end
group :nanoc do group :nanoc do

View file

@ -107,6 +107,7 @@ GEM
json (>= 1.8) json (>= 1.8)
nokogiri (~> 1.6) nokogiri (~> 1.6)
words_counted (1.0.2) words_counted (1.0.2)
yui-compressor (0.12.0)
PLATFORMS PLATFORMS
ruby ruby
@ -132,6 +133,7 @@ DEPENDENCIES
uglifier (>= 4.0.0) uglifier (>= 4.0.0)
w3c_validators w3c_validators
words_counted words_counted
yui-compressor
BUNDLED WITH BUNDLED WITH
1.14.6 1.14.6

View file

@ -7,7 +7,7 @@ created_at: 08-10-2017
time: '27-10-2017 16:00' time: '27-10-2017 16:00'
end: '28-10-2017 12:00' end: '28-10-2017 12:00'
location: 'Therminal, Hoveniersberg 24 9000 Gent' location: 'Therminal, Hoveniersberg 24 9000 Gent'
locationlink: 'Therminal,Ghent Belgium' locationlink: 'Therminal'
facebook: 'https://www.facebook.com/events/1280929475288422/' facebook: 'https://www.facebook.com/events/1280929475288422/'
sponsors: sponsors:

View file

@ -5,7 +5,7 @@ created_at: 19-10-2017
time: '23-11-2017 19:30' time: '23-11-2017 19:30'
end: '23-11-2017 21:00' end: '23-11-2017 21:00'
location: 'Auditorium D, Jozef Plateaustraat 22, 9000 Gent' location: 'Auditorium D, Jozef Plateaustraat 22, 9000 Gent'
locationlink: 'Faculteit Ingenieurswetenschappen en Architectuur' locationlink: Instituut der Wetenschappen
facebook: 'https://www.facebook.com/events/313118845828839/' facebook: 'https://www.facebook.com/events/313118845828839/'
color: '#aea485' color: '#aea485'
gradient: false gradient: false

View file

@ -4,7 +4,7 @@ image: https://www.vlaamseprogrammeerwedstrijd.be/current/images/VPW2018grootP.p
description: Ga mee naar de jaarlijkse Vlaamse Programmeerwedstrijd! description: Ga mee naar de jaarlijkse Vlaamse Programmeerwedstrijd!
time: 14-03-2018 10:00 time: 14-03-2018 10:00
location: Campus Sterre, Gebouw S9 location: Campus Sterre, Gebouw S9
locationlink: Building S9 Universiteit Gent locationlink: S9, Gent
#facebook: https://www.facebook.com/events/226450807821839/ #facebook: https://www.facebook.com/events/226450807821839/
color: "#AAF" color: "#AAF"
end: 14-03-2018 21:30 end: 14-03-2018 21:30

View file

@ -5,7 +5,7 @@ created_at: 20-04-2018
time: 08-05-2018 17:30 time: 08-05-2018 17:30
end: 08-05-2018 23:00 end: 08-05-2018 23:00
location: Lokaal V1, S9, Campus Sterre location: Lokaal V1, S9, Campus Sterre
locationlink: S9, Sterre locationlink: S9 Gent
facebook: 'https://www.facebook.com/events/593833734311046' facebook: 'https://www.facebook.com/events/593833734311046'
--- ---

View file

@ -12,6 +12,9 @@
<meta name="twitter:label2" value="Place" /> <meta name="twitter:label2" value="Place" />
<meta name="twitter:data2" value="<%= item[:location] %>" /> <meta name="twitter:data2" value="<%= item[:location] %>" />
<meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:card" content="summary_large_image" />
<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>
<% end %> <% end %>
<% if item[:banner] %> <% if item[:banner] %>
@ -76,16 +79,72 @@
<%= yield %> <%= yield %>
</div> </div>
<!-- GOOGLE MAPS --> <!-- MAPS -->
<div class="map-wrapper box"> <div class="map-wrapper box">
<iframe height="400" style="width:100%" src="<%= locationlink item[:locationlink] %>" allowfullscreen> </iframe> <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>
</div> </div>
<!-- END GOOGLE MAPS -->
</div> </div>
</div> </div>
</section> </section>
<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();
}
performRequest('https://photon.komoot.de/api/?limit=1&q=<%= URI::encode(item[:locationlink]) %>', function(data) {
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>
<!-- SPONSORED BY --> <!-- SPONSORED BY -->
<% if item[:sponsors] %> <% if item[:sponsors] %>
<section class="section"> <section class="section">

View file

@ -1,5 +1,5 @@
require 'htmlcompressor' require 'htmlcompressor'
Nanoc::Filter.define(:html_press) do |content, _params| Nanoc::Filter.define(:html_press) do |content, options|
HtmlCompressor::Compressor.new.compress content HtmlCompressor::Compressor.new(compress_javascript: true, compress_css: true, remove_quotes: true, simple_boolean_attributes: true).compress content
end end