implement back-to-map

This commit is contained in:
Laura Klünder 2017-06-18 19:09:17 +02:00
parent 5d41fe0e30
commit 0f3fea804a
2 changed files with 10 additions and 1 deletions

View file

@ -80,6 +80,7 @@ editor = {
},
// sidebar
_last_map_path: null,
get_location_path: function () {
return window.location.pathname + window.location.search;
},
@ -151,6 +152,7 @@ editor = {
var geometry_url = content.find('[data-geometry-url]');
if (geometry_url.length) {
editor._last_map_path = editor.get_location_path();
geometry_url = geometry_url.attr('data-geometry-url');
var highlight_type = content.find('[data-list]');
var editing_id = content.find('[data-editing]');
@ -175,6 +177,12 @@ editor = {
bottom: offset_parent.height()-level_control_offset.top-editor._level_control_container.height()-parseInt(editor._level_control_container.css('margin-bottom')),
right: offset_parent.width()-level_control_offset.left
});
} else if (content.find('[data-keep-geometry]').length) {
if (editor._last_map_path === null) $('[data-back-to-map]').remove()
$('a[data-back-to-map]').attr('href', editor._last_map_path);
$('body').removeClass('show-map');
editor._level_control.hide();
editor._sublevel_control.hide();
} else {
$('body').removeClass('map-enabled').removeClass('show-map');
editor._level_control.hide();

View file

@ -4,11 +4,12 @@
{% include 'editor/fragment_levels.html' %}
<form method="post">
<form method="post" data-keep-geometry>
{% csrf_token %}
<h3>{{ changeset.title }}</h3>
<p class="text-muted">{{ desc }}{% if changeset.author %} {{ changeset.author.username }}{% endif %}</p>
<p><a data-back-to-map>« {% trans 'back to map' %}</a></p>
{% for group in grouped_changes %}
<table class="table table-condensed table-h-bordered change-group">