editor url for missing locations too
This commit is contained in:
parent
e70654b4b7
commit
bc3806c53e
4 changed files with 20 additions and 4 deletions
|
@ -22,6 +22,16 @@ editor = {
|
||||||
editor.map.doubleClickZoom.enable();
|
editor.map.doubleClickZoom.enable();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let $map = $('#map');
|
||||||
|
if ($map.is('[data-x][data-y]')) {
|
||||||
|
L.marker(
|
||||||
|
L.GeoJSON.coordsToLatLng([
|
||||||
|
parseFloat($map.attr('data-x')),
|
||||||
|
parseFloat($map.attr('data-y'))
|
||||||
|
]),
|
||||||
|
).addTo(editor.map);
|
||||||
|
}
|
||||||
|
|
||||||
if (window.mobileclient) {
|
if (window.mobileclient) {
|
||||||
var $body = $('body');
|
var $body = $('body');
|
||||||
$body.addClass('mobileclient');
|
$body.addClass('mobileclient');
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="map"></div>
|
<div id="map"{% if request.GET.x %} data-x="{{ request.GET.x }}"{% endif %}{% if request.GET.y %} data-y="{{ request.GET.y }}"{% endif %}></div>
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<div class="content">{{ content | safe }}</div>
|
<div class="content">{{ content | safe }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -165,6 +165,12 @@ class Report(models.Model):
|
||||||
@cached_property
|
@cached_property
|
||||||
def editor_url(self):
|
def editor_url(self):
|
||||||
if self.category == 'missing-location':
|
if self.category == 'missing-location':
|
||||||
|
space = self.coordinates.space
|
||||||
|
if space is not None:
|
||||||
|
return reverse('editor.spaces.detail', kwargs={
|
||||||
|
'pk': space.pk,
|
||||||
|
'level': space.level_id,
|
||||||
|
})+'?x=%.2f&y=%.2f' % (self.coordinates.x, self.coordinates.y)
|
||||||
return None
|
return None
|
||||||
elif self.category == 'location-issue':
|
elif self.category == 'location-issue':
|
||||||
location = self.location_specific
|
location = self.location_specific
|
||||||
|
|
|
@ -5,16 +5,16 @@
|
||||||
<p>
|
<p>
|
||||||
<a href="/l/{{ report.location_specific.slug }}/">{% trans 'open in c3nav' %}</a>
|
<a href="/l/{{ report.location_specific.slug }}/">{% trans 'open in c3nav' %}</a>
|
||||||
{% if report.editor_url %}
|
{% if report.editor_url %}
|
||||||
– <a href="{{ editor_url }}">{% trans 'open in editor' %}</a>
|
– <a href="{{ report.editor_url }}">{% trans 'open in editor' %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
{% elif report.category == 'missing-location' %}
|
{% elif report.category == 'missing-location' %}
|
||||||
<p><strong>{% trans 'You are reporting an missing location at the following position:' %}</strong></p>
|
<p><strong>{% trans 'You are reporting an missing location at the following position:' %}</strong></p>
|
||||||
{% include 'site/fragment_location.html' with form_value=1 location=report.coordinates add_subtitle=report.coordinates_id %}
|
{% include 'site/fragment_location.html' with form_value=1 location=report.coordinates add_subtitle=report.coordinates_id %}
|
||||||
<p>
|
<p>
|
||||||
<a href="/l/{{ report.coordinates.pk }}/">{% trans 'open in c3nav' %}</a> –
|
<a href="/l/{{ report.coordinates.pk }}/">{% trans 'open in c3nav' %}</a>
|
||||||
{% if report.editor_url %}
|
{% if report.editor_url %}
|
||||||
– <a href="{{ editor_url }}">{% trans 'open in editor' %}</a>
|
– <a href="{{ report.editor_url }}">{% trans 'open in editor' %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
{% elif report.category == 'route-issue' %}
|
{% elif report.category == 'route-issue' %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue