diff --git a/src/c3nav/editor/static/editor/js/editor.js b/src/c3nav/editor/static/editor/js/editor.js index 6cd384ab..1bb18387 100644 --- a/src/c3nav/editor/static/editor/js/editor.js +++ b/src/c3nav/editor/static/editor/js/editor.js @@ -22,6 +22,16 @@ editor = { 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) { var $body = $('body'); $body.addClass('mobileclient'); diff --git a/src/c3nav/editor/templates/editor/map.html b/src/c3nav/editor/templates/editor/map.html index dc714745..f9d1dd9c 100644 --- a/src/c3nav/editor/templates/editor/map.html +++ b/src/c3nav/editor/templates/editor/map.html @@ -17,7 +17,7 @@ {% endblock %} {% block content %} -
+ diff --git a/src/c3nav/mapdata/models/report.py b/src/c3nav/mapdata/models/report.py index a37a1fa3..ee543bb9 100644 --- a/src/c3nav/mapdata/models/report.py +++ b/src/c3nav/mapdata/models/report.py @@ -165,6 +165,12 @@ class Report(models.Model): @cached_property def editor_url(self): 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 elif self.category == 'location-issue': location = self.location_specific diff --git a/src/c3nav/site/templates/site/fragment_report_meta.html b/src/c3nav/site/templates/site/fragment_report_meta.html index 8ceb8efe..915f8e98 100644 --- a/src/c3nav/site/templates/site/fragment_report_meta.html +++ b/src/c3nav/site/templates/site/fragment_report_meta.html @@ -5,16 +5,16 @@{% trans 'open in c3nav' %} {% if report.editor_url %} - – {% trans 'open in editor' %} + – {% trans 'open in editor' %} {% endif %}
{% elif report.category == 'missing-location' %}{% trans 'You are reporting an missing location at the following position:' %}
{% include 'site/fragment_location.html' with form_value=1 location=report.coordinates add_subtitle=report.coordinates_id %}- {% trans 'open in c3nav' %} – + {% trans 'open in c3nav' %} {% if report.editor_url %} - – {% trans 'open in editor' %} + – {% trans 'open in editor' %} {% endif %}
{% elif report.category == 'route-issue' %}