umap/umap/templates/umap/content.html
Yohan Boniface af8745e2d7 Do use an ancestors of maps for ui
Otherwise, each map will react to the `.storage-ui xxx` css rule.
2016-09-18 15:27:18 +02:00

80 lines
2.1 KiB
HTML

{% extends "base.html" %}
{% load leaflet_storage_tags compress i18n %}
{% block body_class %}content{% endblock %}
{% block extra_head %}
{% compress css %}
{% leaflet_storage_css %}
{% endcompress css %}
{% leaflet_storage_js %}
{% endblock %}
{% block header %}
<header class="wrapper">
{% include 'umap/navigation.html' %}
</header>
{% endblock %}
{% block content %}
{% block maincontent %}
{% endblock maincontent %}
{% endblock content %}
{% block bottom_js %}
{{ block.super }}
<script type="text/javascript">
!(function() {
var ui = new L.S.UI(document.querySelector('header'));
var xhr = new L.S.Xhr(ui);
var login = document.querySelector('a.login');
if (login) {
L.DomEvent.on(login, 'click', function (e) {
L.DomEvent.stop(e);
xhr.login({
"login_required": this.getAttribute('href'),
"redirect": "/"
});
});
}
var logout = document.querySelector('a.logout');
if (logout) {
L.DomEvent.on(logout, 'click', function (e) {
L.DomEvent.stop(e);
xhr.logout(this.getAttribute('href'));
});
}
var getMore = function (e) {
L.DomEvent.stop(e);
xhr._ajax({
uri: this.href,
verb: 'GET',
callback: function (data) {
var container = this.parentNode;
container.innerHTML = data;
Array.prototype.forEach.call(container.querySelectorAll('script'), function (item) {
eval(item.firstChild.textContent);
});
var more = document.querySelector('.more_button');
if (more) {
L.DomEvent.on(more, 'click', getMore, more);
}
},
context: this
});
};
var more = document.querySelector('.more_button');
if (more) {
L.DomEvent.on(more, 'click', getMore, more);
}
})(this);
</script>
{% endblock bottom_js %}
{% block footer %}
{{ block.super }}
<footer>
<a href="/">umap</a> an OpenStreetMap project (version {{ UMAP_VERSION }})
</footer>
{% endblock footer %}