72 lines
No EOL
2.7 KiB
HTML
72 lines
No EOL
2.7 KiB
HTML
{% extends 'base.html' %}
|
|
{% load static %}
|
|
{% block content %}
|
|
<h1>Les sauveteurs du Dunkerquois</h1>
|
|
<section>
|
|
<h2>Carte dynamique</h2>
|
|
<div id="map" style="width:100%; height:60%"></div>
|
|
</section>
|
|
<section>
|
|
<h2>Articles récents</h2>
|
|
<div class="flex-card">
|
|
{% for rescue in rescues %}
|
|
<div class="card">
|
|
<div class="inner">
|
|
<div class="img-container">
|
|
<img src="{% static 'images/sauvetage.png' %}">
|
|
</div>
|
|
<div class="content">
|
|
<p class="date">{{ rescue.date }}</p>
|
|
<p class="titre">{{ rescue.name }}</p>
|
|
<a class="btn" href="/a/{{ rescue.pk }}">Voir l'article</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</section>
|
|
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>
|
|
<script>
|
|
let counter = 0;
|
|
let map = L.map('map').setView([51.127, 2.253], 7);
|
|
|
|
const iconRetinaUrl = '{% static 'images/marker-icon-2x.png' %}';
|
|
const iconUrl = '{% static 'images/marker-icon.png' %}';
|
|
const shadowUrl = '{% static 'images/marker-shadow.png' %}';
|
|
const iconDefault = L.icon({
|
|
iconRetinaUrl,
|
|
iconUrl,
|
|
shadowUrl,
|
|
iconSize: [25, 41],
|
|
iconAnchor: [12, 41],
|
|
popupAnchor: [1, -34],
|
|
tooltipAnchor: [16, -28],
|
|
shadowSize: [41, 41]
|
|
});
|
|
|
|
L.Marker.prototype.options.icon = iconDefault;
|
|
|
|
let osmLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
|
|
attribution: '© OpenStreetMap contributors',
|
|
maxZoom: 19
|
|
});
|
|
|
|
{% for rescue in rescues %}
|
|
L.marker([{{ rescue.location_long }}, {{ rescue.location_lat }}]).addTo(map).bindPopup('<a href="/a/{{ rescue.pk }}/">{{ rescue.name }}</a>');
|
|
{% endfor %}
|
|
|
|
map.addLayer(osmLayer);
|
|
map.addEventListener('click', function(){
|
|
counter++;
|
|
console.log("rickroll loaded");
|
|
checkRickroll();
|
|
});
|
|
function checkRickroll(){
|
|
if(counter > 5){
|
|
counter = -9999;
|
|
L.marker([51.51307, -0.22003]).addTo(map).bindPopup('<a target="_blank" href="https://www.youtube.com/watch?v=hJresi7z_YM">Christmas Present !</a>');
|
|
}
|
|
}
|
|
</script>
|
|
{% include 'quicksearch.html' %}
|
|
{% endblock %} |