2017-10-08 20:21:51 +00:00
|
|
|
|
{% extends "base_with_jumbo.html" %}
|
2017-05-22 23:12:04 +00:00
|
|
|
|
{% load bootstrap3 %}
|
2017-05-20 23:47:14 +00:00
|
|
|
|
{% load i18n %}
|
|
|
|
|
{% load leaflet_tags %}
|
2017-11-18 16:54:44 +00:00
|
|
|
|
{% load static %}
|
2017-06-16 16:06:22 +00:00
|
|
|
|
|
|
|
|
|
{% block stylesheets %}
|
2018-03-31 11:12:06 +00:00
|
|
|
|
{{ block.super }}
|
|
|
|
|
{% leaflet_css %}
|
|
|
|
|
<style>
|
|
|
|
|
html, body, #main {
|
|
|
|
|
width: 100;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
2017-06-16 16:06:22 +00:00
|
|
|
|
|
2018-03-31 11:12:06 +00:00
|
|
|
|
.leaflet-popup-content > a {
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
2017-06-16 16:06:22 +00:00
|
|
|
|
|
2018-03-31 11:12:06 +00:00
|
|
|
|
.popup-head h5 {
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
}
|
2017-06-16 16:06:22 +00:00
|
|
|
|
|
2018-03-31 11:12:06 +00:00
|
|
|
|
.popup-head p {
|
|
|
|
|
margin-top: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.popup-labels {
|
|
|
|
|
margin: 10px auto 15px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.popup-labels .label {
|
|
|
|
|
font-size: 100%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2018-04-16 02:59:48 +00:00
|
|
|
|
|
2018-03-31 11:12:06 +00:00
|
|
|
|
{% endblock %}
|
|
|
|
|
|
2017-11-18 16:54:44 +00:00
|
|
|
|
{% block inner_content %}
|
2017-06-16 16:06:22 +00:00
|
|
|
|
<div id="main"></div>
|
2018-03-31 11:12:06 +00:00
|
|
|
|
<div id="modals"></div>
|
2018-04-16 02:59:48 +00:00
|
|
|
|
|
|
|
|
|
<div class="hello" style="display: none">
|
|
|
|
|
<div class="hello--container">
|
|
|
|
|
<div class="hello--text">
|
|
|
|
|
<img class="hello--logo" align="center" src="{% static 'map/images/ojuso-logo-black.png' %}" alt="Ojuso">
|
2018-04-19 17:01:16 +00:00
|
|
|
|
{% blocktrans trimmed with forum_url='//forum.ojuso.org' %}
|
|
|
|
|
<p>
|
|
|
|
|
<b>ojuso</b>’s aim is to promote best practice in the renewable energy
|
|
|
|
|
industry, to encourage divestment from ecologically and socially
|
|
|
|
|
destructive projects, and to foster improvements in supply chain and
|
|
|
|
|
lifecycle management in the sector.
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<b>ojuso</b> provides a platform for information exchange and
|
|
|
|
|
cooperation between different sectors involved in the renewable energy
|
|
|
|
|
economy and is supportive of ethical and ecologically sound practices.
|
|
|
|
|
This platform consists of an online map and database of positive and
|
|
|
|
|
negative case studies, contributed by communities affected by and
|
|
|
|
|
leading the transition, and a series of discussion fora and features,
|
|
|
|
|
contributed by a diversity of players.
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
You are welcome to submit a case study through this map tool.
|
|
|
|
|
Following submission, cases will be moderated and, if successful,
|
|
|
|
|
placed on the map. If you need any help or have any suggestions,
|
|
|
|
|
please post messages on <a href="{{ forum_url }}">our forum</a>.
|
|
|
|
|
</p>
|
|
|
|
|
{% endblocktrans %}
|
|
|
|
|
<p class="text-muted">
|
|
|
|
|
{% trans "<b>ojuso</b> is a project of Yansa and Gaia Foundation, with support from Swift Foundation." %}
|
|
|
|
|
</p>
|
|
|
|
|
<button class="hello--hide btn btn-primary">{% trans "OK" %}</button>
|
2018-04-16 02:59:48 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2017-06-16 16:06:22 +00:00
|
|
|
|
{% endblock %}
|
|
|
|
|
|
2018-04-14 11:46:01 +00:00
|
|
|
|
{% block footer %}
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
2017-06-16 16:06:22 +00:00
|
|
|
|
{% block scripts %}
|
2018-03-31 11:12:06 +00:00
|
|
|
|
{% leaflet_map "main" callback="main_app_init" creatediv=False %}
|
|
|
|
|
{% leaflet_js %}
|
2018-04-16 02:59:48 +00:00
|
|
|
|
<script src="{% static 'map/plugins/leaflet-hash.js' %}"></script>
|
2018-03-31 11:12:06 +00:00
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
function getLabelClass(pos_or_neg) {
|
|
|
|
|
if (pos_or_neg == "N") {
|
|
|
|
|
return "danger";
|
|
|
|
|
} else {
|
|
|
|
|
return "success";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-13 05:04:44 +00:00
|
|
|
|
function caseStudyPopup(feature, layer) {
|
2018-06-18 19:28:16 +00:00
|
|
|
|
var str = '';
|
|
|
|
|
if(feature.properties.images.length > 0) {
|
|
|
|
|
str = "<img src='"+feature.properties.images[0].file+"' width='100%'>";
|
|
|
|
|
}
|
|
|
|
|
str += ("<div class='popup-head'>"+
|
|
|
|
|
"<h5>"+feature.properties.entry_name+"</h5>" +
|
|
|
|
|
"<i>"+feature.properties.country_name+"</i>"+
|
|
|
|
|
"</div>"+
|
|
|
|
|
"<div class='popup-labels'>"+
|
|
|
|
|
"<span class='label label-default'>"+feature.properties.sector_of_economy+"</span> "+
|
|
|
|
|
"<span class='label label-"+getLabelClass(feature.properties.positive_or_negative)+"'>"+ feature.properties.positive_or_negative_display+"</span>"+
|
|
|
|
|
"</div>"+
|
|
|
|
|
"<a class='btn btn-sm btn-primary' href='case-study/"+feature.properties.slug+"'>{% trans "View full case study" %}</a>")
|
2018-10-13 05:04:44 +00:00
|
|
|
|
|
2018-06-18 19:28:16 +00:00
|
|
|
|
layer.bindPopup(str);
|
2018-10-13 05:04:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function poiPopup(feature, layer) {
|
|
|
|
|
str = (
|
|
|
|
|
"<div class='popup-head'>"+
|
|
|
|
|
"<h5>"+feature.properties.title+"</h5>" +
|
|
|
|
|
"</div>"+
|
|
|
|
|
"<p>"+feature.properties.synopsis+"</p>"+
|
|
|
|
|
"<p><a href='"+feature.properties.link+"'>Link</a></p>"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
layer.bindPopup(str);
|
|
|
|
|
}
|
2018-03-31 11:12:06 +00:00
|
|
|
|
|
|
|
|
|
// This is called when the map is initialized
|
|
|
|
|
function main_app_init(map, options) {
|
|
|
|
|
var hash = new L.hash(map);
|
|
|
|
|
|
|
|
|
|
// Pull data as GeoJSON and add to map with a modal
|
|
|
|
|
$.getJSON('/api/case-studies/', function(data) {
|
|
|
|
|
L.geoJson(data, {
|
2018-10-13 05:04:44 +00:00
|
|
|
|
onEachFeature: caseStudyPopup
|
|
|
|
|
}).addTo(map)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var geojsonMarkerOptions = {
|
|
|
|
|
radius: 4,
|
|
|
|
|
fillColor: "#ff7800",
|
|
|
|
|
color: "#000",
|
|
|
|
|
weight: 1,
|
|
|
|
|
opacity: 1,
|
|
|
|
|
fillOpacity: 0.8
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Pull data as GeoJSON and add to map with a modal
|
|
|
|
|
$.getJSON('/api/points-of-interest/', function(data) {
|
|
|
|
|
L.geoJson(data, {
|
|
|
|
|
pointToLayer: function (feature, latlng) {
|
|
|
|
|
return L.circleMarker(latlng, geojsonMarkerOptions);
|
|
|
|
|
},
|
|
|
|
|
onEachFeature: poiPopup
|
2018-03-31 11:12:06 +00:00
|
|
|
|
}).addTo(map)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2018-04-16 02:59:48 +00:00
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
function initOverlay() {
|
|
|
|
|
var cookieName = '__welcomePage_seenBefore'
|
|
|
|
|
if (!Cookies.get(cookieName)) {
|
|
|
|
|
$('.hello').show()
|
|
|
|
|
$('.hello--hide').on('click', function(evt) {
|
|
|
|
|
$('.hello').hide()
|
|
|
|
|
Cookies.set(cookieName, "true")
|
|
|
|
|
})
|
2018-03-31 11:12:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-16 02:59:48 +00:00
|
|
|
|
initOverlay()
|
|
|
|
|
</script>
|
|
|
|
|
{% endblock %}
|