umap-project 2.1.2__py3-none-any.whl → 2.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/context_processors.py +1 -0
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/en/LC_MESSAGES/django.po +32 -32
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/migrations/0020_alter_tilelayer_url_template.py +19 -0
- umap/migrations/0021_remove_map_description.py +16 -0
- umap/models.py +10 -6
- umap/settings/base.py +1 -0
- umap/static/umap/base.css +43 -156
- umap/static/umap/content.css +7 -25
- umap/static/umap/css/icon.css +112 -0
- umap/static/umap/css/panel.css +140 -0
- umap/static/umap/img/16-white.svg +5 -1
- umap/static/umap/img/16.svg +7 -4
- umap/static/umap/img/24-white.svg +3 -1
- umap/static/umap/img/24.svg +3 -4
- umap/static/umap/img/source/16-white.svg +176 -940
- umap/static/umap/img/source/16.svg +8 -5
- umap/static/umap/img/source/24-white.svg +5 -3
- umap/static/umap/img/source/24.svg +6 -7
- umap/static/umap/js/modules/browser.js +97 -73
- umap/static/umap/js/modules/dompurify.js +12 -0
- umap/static/umap/js/modules/facets.js +149 -0
- umap/static/umap/js/modules/global.js +9 -1
- umap/static/umap/js/modules/i18n.js +7 -0
- umap/static/umap/js/modules/orderable.js +84 -0
- umap/static/umap/js/modules/panel.js +76 -0
- umap/static/umap/js/modules/request.js +0 -1
- umap/static/umap/js/modules/schema.js +324 -223
- umap/static/umap/js/modules/urls.js +1 -16
- umap/static/umap/js/modules/utils.js +340 -0
- umap/static/umap/js/umap.autocomplete.js +40 -25
- umap/static/umap/js/umap.controls.js +248 -361
- umap/static/umap/js/umap.core.js +77 -366
- umap/static/umap/js/umap.datalayer.permissions.js +1 -1
- umap/static/umap/js/umap.features.js +65 -43
- umap/static/umap/js/umap.forms.js +128 -36
- umap/static/umap/js/umap.icon.js +11 -4
- umap/static/umap/js/umap.importer.js +78 -58
- umap/static/umap/js/umap.js +206 -192
- umap/static/umap/js/umap.layer.js +86 -46
- umap/static/umap/js/umap.permissions.js +13 -9
- umap/static/umap/js/umap.popup.js +26 -30
- umap/static/umap/js/umap.share.js +12 -9
- umap/static/umap/js/umap.tableeditor.js +4 -6
- umap/static/umap/js/umap.ui.js +10 -60
- umap/static/umap/locale/am_ET.js +243 -227
- umap/static/umap/locale/am_ET.json +21 -9
- umap/static/umap/locale/ar.js +243 -227
- umap/static/umap/locale/ar.json +21 -9
- umap/static/umap/locale/ast.js +243 -227
- umap/static/umap/locale/ast.json +21 -9
- umap/static/umap/locale/bg.js +243 -227
- umap/static/umap/locale/bg.json +21 -9
- umap/static/umap/locale/br.js +253 -237
- umap/static/umap/locale/br.json +25 -13
- umap/static/umap/locale/ca.js +243 -227
- umap/static/umap/locale/ca.json +21 -9
- umap/static/umap/locale/cs_CZ.js +243 -227
- umap/static/umap/locale/cs_CZ.json +21 -9
- umap/static/umap/locale/da.js +243 -227
- umap/static/umap/locale/da.json +21 -9
- umap/static/umap/locale/de.js +243 -227
- umap/static/umap/locale/de.json +21 -9
- umap/static/umap/locale/el.js +243 -227
- umap/static/umap/locale/el.json +21 -9
- umap/static/umap/locale/en.js +243 -234
- umap/static/umap/locale/en.json +22 -10
- umap/static/umap/locale/en_US.json +21 -9
- umap/static/umap/locale/es.js +243 -227
- umap/static/umap/locale/es.json +21 -9
- umap/static/umap/locale/et.js +243 -227
- umap/static/umap/locale/et.json +21 -9
- umap/static/umap/locale/eu.js +227 -199
- umap/static/umap/locale/eu.json +1 -1
- umap/static/umap/locale/fa_IR.js +243 -227
- umap/static/umap/locale/fa_IR.json +21 -9
- umap/static/umap/locale/fi.js +243 -227
- umap/static/umap/locale/fi.json +21 -9
- umap/static/umap/locale/fr.js +243 -234
- umap/static/umap/locale/fr.json +21 -9
- umap/static/umap/locale/gl.js +243 -227
- umap/static/umap/locale/gl.json +21 -9
- umap/static/umap/locale/he.js +243 -227
- umap/static/umap/locale/he.json +21 -9
- umap/static/umap/locale/hr.js +243 -227
- umap/static/umap/locale/hr.json +21 -9
- umap/static/umap/locale/hu.js +243 -234
- umap/static/umap/locale/hu.json +21 -9
- umap/static/umap/locale/id.js +243 -227
- umap/static/umap/locale/id.json +21 -9
- umap/static/umap/locale/is.js +243 -227
- umap/static/umap/locale/is.json +21 -9
- umap/static/umap/locale/it.js +243 -234
- umap/static/umap/locale/it.json +21 -9
- umap/static/umap/locale/ja.js +243 -227
- umap/static/umap/locale/ja.json +21 -9
- umap/static/umap/locale/ko.js +243 -227
- umap/static/umap/locale/ko.json +21 -9
- umap/static/umap/locale/lt.js +243 -227
- umap/static/umap/locale/lt.json +21 -9
- umap/static/umap/locale/ms.js +243 -234
- umap/static/umap/locale/ms.json +22 -10
- umap/static/umap/locale/nl.js +246 -230
- umap/static/umap/locale/nl.json +21 -9
- umap/static/umap/locale/no.js +243 -227
- umap/static/umap/locale/no.json +21 -9
- umap/static/umap/locale/pl.js +243 -227
- umap/static/umap/locale/pl.json +21 -9
- umap/static/umap/locale/pl_PL.json +21 -9
- umap/static/umap/locale/pt.js +243 -227
- umap/static/umap/locale/pt.json +21 -9
- umap/static/umap/locale/pt_BR.js +243 -227
- umap/static/umap/locale/pt_BR.json +21 -9
- umap/static/umap/locale/pt_PT.js +243 -227
- umap/static/umap/locale/pt_PT.json +21 -9
- umap/static/umap/locale/ro.js +243 -227
- umap/static/umap/locale/ro.json +21 -9
- umap/static/umap/locale/ru.js +243 -227
- umap/static/umap/locale/ru.json +21 -9
- umap/static/umap/locale/si.js +1 -1
- umap/static/umap/locale/si.json +1 -1
- umap/static/umap/locale/sk_SK.js +243 -227
- umap/static/umap/locale/sk_SK.json +21 -9
- umap/static/umap/locale/sl.js +243 -227
- umap/static/umap/locale/sl.json +21 -9
- umap/static/umap/locale/sr.js +243 -227
- umap/static/umap/locale/sr.json +21 -9
- umap/static/umap/locale/sv.js +243 -227
- umap/static/umap/locale/sv.json +21 -9
- umap/static/umap/locale/th_TH.js +243 -227
- umap/static/umap/locale/th_TH.json +21 -9
- umap/static/umap/locale/tr.js +243 -227
- umap/static/umap/locale/tr.json +21 -9
- umap/static/umap/locale/uk_UA.js +243 -227
- umap/static/umap/locale/uk_UA.json +21 -9
- umap/static/umap/locale/vi.js +243 -227
- umap/static/umap/locale/vi.json +21 -9
- umap/static/umap/locale/vi_VN.json +21 -9
- umap/static/umap/locale/zh.js +243 -227
- umap/static/umap/locale/zh.json +21 -9
- umap/static/umap/locale/zh_CN.json +21 -9
- umap/static/umap/locale/zh_TW.Big5.json +21 -9
- umap/static/umap/locale/zh_TW.js +243 -234
- umap/static/umap/locale/zh_TW.json +21 -9
- umap/static/umap/map.css +124 -264
- umap/static/umap/test/DataLayer.js +1 -1
- umap/static/umap/test/Feature.js +0 -226
- umap/static/umap/test/Map.js +0 -304
- umap/static/umap/test/Polygon.js +0 -256
- umap/static/umap/test/Polyline.js +0 -116
- umap/static/umap/test/TableEditor.js +10 -10
- umap/static/umap/test/Util.js +0 -521
- umap/static/umap/test/index.html +1 -5
- umap/static/umap/unittests/URLs.js +1 -1
- umap/static/umap/unittests/utils.js +610 -0
- umap/static/umap/vars.css +9 -0
- umap/static/umap/vendors/dompurify/purify.es.mjs +1525 -0
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +1 -0
- umap/static/umap/vendors/iconlayers/iconLayers.js +1 -1
- umap/templates/umap/css.html +2 -0
- umap/templates/umap/js.html +0 -1
- umap/templates/umap/map_detail.html +4 -0
- umap/templates/umap/map_table.html +12 -10
- umap/templatetags/umap_tags.py +5 -0
- umap/tests/conftest.py +9 -0
- umap/tests/fixtures/test_upload_data.csv +2 -1
- umap/tests/fixtures/test_upload_data.umap +171 -0
- umap/tests/fixtures/test_upload_data_osm.json +33 -0
- umap/tests/integration/conftest.py +16 -0
- umap/tests/integration/test_anonymous_owned_map.py +30 -5
- umap/tests/integration/test_basics.py +21 -0
- umap/tests/integration/test_browser.py +16 -36
- umap/tests/integration/test_choropleth.py +89 -0
- umap/tests/integration/test_collaborative_editing.py +30 -1
- umap/tests/integration/test_dashboard.py +10 -0
- umap/tests/integration/test_datalayer.py +132 -0
- umap/tests/integration/test_draw_polygon.py +363 -0
- umap/tests/integration/test_draw_polyline.py +325 -0
- umap/tests/integration/test_edit_datalayer.py +145 -6
- umap/tests/integration/test_edit_map.py +202 -0
- umap/tests/integration/test_edit_marker.py +120 -0
- umap/tests/integration/test_edit_polygon.py +122 -0
- umap/tests/integration/test_facets_browser.py +132 -11
- umap/tests/integration/test_import.py +407 -10
- umap/tests/integration/test_map.py +36 -54
- umap/tests/integration/test_map_list.py +28 -0
- umap/tests/integration/test_owned_map.py +24 -6
- umap/tests/integration/test_picto.py +25 -38
- umap/tests/integration/test_querystring.py +9 -15
- umap/tests/integration/test_slideshow.py +0 -5
- umap/tests/integration/test_statics.py +3 -2
- umap/tests/integration/test_tableeditor.py +23 -0
- umap/tests/integration/test_tilelayer.py +10 -0
- umap/tests/integration/test_view_marker.py +64 -0
- umap/tests/integration/test_view_polygon.py +59 -0
- umap/tests/integration/test_view_polyline.py +51 -0
- umap/tests/test_map_views.py +13 -0
- {umap_project-2.1.2.dist-info → umap_project-2.2.0.dist-info}/METADATA +12 -12
- {umap_project-2.1.2.dist-info → umap_project-2.2.0.dist-info}/RECORD +206 -187
- {umap_project-2.1.2.dist-info → umap_project-2.2.0.dist-info}/WHEEL +1 -1
- umap/static/umap/test/Choropleth.js +0 -245
- umap/static/umap/test/Permissions.js +0 -74
- umap/static/umap/vendors/dompurify/purify.min.js +0 -3
- umap/static/umap/vendors/dompurify/purify.min.js.map +0 -1
- umap/tests/integration/test_drawing.py +0 -243
- {umap_project-2.1.2.dist-info → umap_project-2.2.0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.1.2.dist-info → umap_project-2.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -208,6 +208,7 @@ L.FormBuilder.Textarea = L.FormBuilder.Element.extend({
|
|
|
208
208
|
build: function () {
|
|
209
209
|
this.input = L.DomUtil.create('textarea', this.options.className || '', this.parentNode);
|
|
210
210
|
if (this.options.placeholder) this.input.placeholder = this.options.placeholder;
|
|
211
|
+
this.input.name = this.name;
|
|
211
212
|
this.fetch();
|
|
212
213
|
L.DomEvent.on(this.input, 'input', this.sync, this);
|
|
213
214
|
L.DomEvent.on(this.input, 'keypress', this.onKeyPress, this);
|
umap/templates/umap/css.html
CHANGED
|
@@ -23,8 +23,10 @@
|
|
|
23
23
|
href="{% static 'umap/vendors/iconlayers/iconLayers.css' %}" />
|
|
24
24
|
<link rel="stylesheet" href="{% static 'umap/vars.css' %}" />
|
|
25
25
|
<link rel="stylesheet" href="{% static 'umap/font.css' %}" />
|
|
26
|
+
<link rel="stylesheet" href="{% static 'umap/css/icon.css' %}" />
|
|
26
27
|
<link rel="stylesheet" href="{% static 'umap/base.css' %}" />
|
|
27
28
|
<link rel="stylesheet" href="{% static 'umap/content.css' %}" />
|
|
28
29
|
<link rel="stylesheet" href="{% static 'umap/nav.css' %}" />
|
|
29
30
|
<link rel="stylesheet" href="{% static 'umap/map.css' %}" />
|
|
31
|
+
<link rel="stylesheet" href="{% static 'umap/css/panel.css' %}" />
|
|
30
32
|
<link rel="stylesheet" href="{% static 'umap/theme.css' %}" />
|
umap/templates/umap/js.html
CHANGED
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
<script src="{% static 'umap/vendors/tokml/tokml.js' %}" defer></script>
|
|
43
43
|
<script src="{% static 'umap/vendors/locatecontrol/L.Control.Locate.min.js' %}"
|
|
44
44
|
defer></script>
|
|
45
|
-
<script src="{% static 'umap/vendors/dompurify/purify.min.js' %}" defer></script>
|
|
46
45
|
<script src="{% static 'umap/vendors/colorbrewer/colorbrewer.js' %}" defer></script>
|
|
47
46
|
<script src="{% static 'umap/vendors/simple-statistics/simple-statistics.min.js' %}"
|
|
48
47
|
defer></script>
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
type="application/json+oembed"
|
|
19
19
|
href="{{ oembed_absolute_uri }}?url={{ quoted_absolute_uri }}&format=json"
|
|
20
20
|
title="{{ map.name }} oEmbed URL" />
|
|
21
|
+
<meta property="og:url" content="{{ SITE_URL }}{{ map.get_absolute_url }}" />
|
|
22
|
+
<meta property="og:title" content="{{ map.name }}" />
|
|
23
|
+
<meta property="og:description" content="{{ map.description }}" />
|
|
24
|
+
<meta property="og:site_name" content="{{ SITE_NAME }}" />
|
|
21
25
|
{% endblock extra_head %}
|
|
22
26
|
{% block content %}
|
|
23
27
|
{% block map_init %}
|
|
@@ -68,16 +68,18 @@
|
|
|
68
68
|
<span class="sr-only">{% translate "Clone" %}</span>
|
|
69
69
|
</button>
|
|
70
70
|
</form>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
{% if map_inst|can_delete_map:request %}
|
|
72
|
+
<form action="{% url 'map_delete' map_inst.pk %}"
|
|
73
|
+
method="post"
|
|
74
|
+
class="map-delete">
|
|
75
|
+
{% csrf_token %}
|
|
76
|
+
<input type="hidden" name="next" value="{% url 'user_dashboard' %}">
|
|
77
|
+
<button class="map-icon" type="submit" title="{% translate "Delete" %}">
|
|
78
|
+
<span class="icon-dashboard icon-delete"></span>
|
|
79
|
+
<span class="sr-only">{% translate "Delete" %}</span>
|
|
80
|
+
</button>
|
|
81
|
+
</form>
|
|
82
|
+
{% endif %}
|
|
81
83
|
</td>
|
|
82
84
|
</tr>
|
|
83
85
|
{% endwith %}
|
umap/templatetags/umap_tags.py
CHANGED
umap/tests/conftest.py
CHANGED
|
@@ -5,6 +5,8 @@ import pytest
|
|
|
5
5
|
from django.core.cache import cache
|
|
6
6
|
from django.core.signing import get_cookie_signer
|
|
7
7
|
|
|
8
|
+
from umap.models import Map
|
|
9
|
+
|
|
8
10
|
from .base import (
|
|
9
11
|
DataLayerFactory,
|
|
10
12
|
LicenceFactory,
|
|
@@ -48,6 +50,13 @@ def map(licence, tilelayer):
|
|
|
48
50
|
return MapFactory(owner=user, licence=licence)
|
|
49
51
|
|
|
50
52
|
|
|
53
|
+
@pytest.fixture
|
|
54
|
+
def openmap(map):
|
|
55
|
+
map.edit_status = Map.ANONYMOUS
|
|
56
|
+
map.save()
|
|
57
|
+
return map
|
|
58
|
+
|
|
59
|
+
|
|
51
60
|
@pytest.fixture
|
|
52
61
|
def anonymap(map):
|
|
53
62
|
map.owner = None
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "umap",
|
|
3
|
+
"geometry": {
|
|
4
|
+
"type": "Point",
|
|
5
|
+
"coordinates": [
|
|
6
|
+
3.0528,
|
|
7
|
+
50.6269
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"properties": {
|
|
11
|
+
"umap_id": 666,
|
|
12
|
+
"longCredit": "the illustrious mapmaker",
|
|
13
|
+
"shortCredit": "the mapmaker",
|
|
14
|
+
"slideshow": {},
|
|
15
|
+
"captionBar": true,
|
|
16
|
+
"dashArray": "5,5",
|
|
17
|
+
"fillOpacity": "0.5",
|
|
18
|
+
"fillColor": "Crimson",
|
|
19
|
+
"fill": true,
|
|
20
|
+
"weight": "2",
|
|
21
|
+
"opacity": "0.9",
|
|
22
|
+
"smoothFactor": "1",
|
|
23
|
+
"iconClass": "Drop",
|
|
24
|
+
"color": "Red",
|
|
25
|
+
"limitBounds": {},
|
|
26
|
+
"tilelayer": {
|
|
27
|
+
"maxZoom": 20,
|
|
28
|
+
"url_template": "https://tile.openstreetmap.fr/hot/{z}/{x}/{y}.png",
|
|
29
|
+
"minZoom": 0,
|
|
30
|
+
"attribution": "map data © [[https://osm.org/copyright|OpenStreetMap contributors]] under ODbL - Tiles © HOT",
|
|
31
|
+
"name": "OSM Humanitarian (OSM-FR)"
|
|
32
|
+
},
|
|
33
|
+
"licence": {
|
|
34
|
+
"url": "",
|
|
35
|
+
"name": "No licence set"
|
|
36
|
+
},
|
|
37
|
+
"description": "Map description",
|
|
38
|
+
"name": "Imported map",
|
|
39
|
+
"tilelayersControl": true,
|
|
40
|
+
"onLoadPanel": "caption",
|
|
41
|
+
"displayPopupFooter": true,
|
|
42
|
+
"miniMap": true,
|
|
43
|
+
"moreControl": true,
|
|
44
|
+
"scaleControl": true,
|
|
45
|
+
"zoomControl": true,
|
|
46
|
+
"scrollWheelZoom": true,
|
|
47
|
+
"datalayersControl": true,
|
|
48
|
+
"zoom": 6
|
|
49
|
+
},
|
|
50
|
+
"layers": [
|
|
51
|
+
{
|
|
52
|
+
"type": "FeatureCollection",
|
|
53
|
+
"features": [
|
|
54
|
+
{
|
|
55
|
+
"type": "Feature",
|
|
56
|
+
"geometry": {
|
|
57
|
+
"type": "Polygon",
|
|
58
|
+
"coordinates": [
|
|
59
|
+
[
|
|
60
|
+
[
|
|
61
|
+
4.2939,
|
|
62
|
+
50.8893
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
4.2441,
|
|
66
|
+
50.8196
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
4.3869,
|
|
70
|
+
50.7642
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
4.4813,
|
|
74
|
+
50.7929
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
4.413,
|
|
78
|
+
50.9119
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
4.2939,
|
|
82
|
+
50.8893
|
|
83
|
+
]
|
|
84
|
+
]
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"properties": {
|
|
88
|
+
"name": "Bruxelles",
|
|
89
|
+
"description": "polygon"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"type": "Feature",
|
|
94
|
+
"geometry": {
|
|
95
|
+
"type": "Point",
|
|
96
|
+
"coordinates": [
|
|
97
|
+
3.0528,
|
|
98
|
+
50.6269
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"properties": {
|
|
102
|
+
"_umap_options": {
|
|
103
|
+
"color": "Orange"
|
|
104
|
+
},
|
|
105
|
+
"name": "Lille",
|
|
106
|
+
"description": "une ville"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"_umap_options": {
|
|
111
|
+
"displayOnLoad": true,
|
|
112
|
+
"name": "Cities",
|
|
113
|
+
"id": 108,
|
|
114
|
+
"remoteData": {},
|
|
115
|
+
"description": "A layer with some cities",
|
|
116
|
+
"color": "Navy",
|
|
117
|
+
"iconClass": "Drop",
|
|
118
|
+
"smoothFactor": "1",
|
|
119
|
+
"dashArray": "5,1",
|
|
120
|
+
"fillOpacity": "0.5",
|
|
121
|
+
"fillColor": "Blue",
|
|
122
|
+
"fill": true
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"type": "FeatureCollection",
|
|
127
|
+
"features": [
|
|
128
|
+
{
|
|
129
|
+
"type": "Feature",
|
|
130
|
+
"geometry": {
|
|
131
|
+
"type": "LineString",
|
|
132
|
+
"coordinates": [
|
|
133
|
+
[
|
|
134
|
+
1.7715,
|
|
135
|
+
50.9255
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
1.6589,
|
|
139
|
+
50.9696
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
1.4941,
|
|
143
|
+
51.0128
|
|
144
|
+
],
|
|
145
|
+
[
|
|
146
|
+
1.4199,
|
|
147
|
+
51.0638
|
|
148
|
+
],
|
|
149
|
+
[
|
|
150
|
+
1.2881,
|
|
151
|
+
51.1104
|
|
152
|
+
]
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
"properties": {
|
|
156
|
+
"_umap_options": {
|
|
157
|
+
"weight": "4"
|
|
158
|
+
},
|
|
159
|
+
"name": "tunnel sous la Manche"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"_umap_options": {
|
|
164
|
+
"displayOnLoad": true,
|
|
165
|
+
"name": "Tunnels",
|
|
166
|
+
"id": 109,
|
|
167
|
+
"remoteData": {}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 0.6,
|
|
3
|
+
"generator": "Overpass API 0.7.55.4 3079d8ea",
|
|
4
|
+
"osm3s": {
|
|
5
|
+
"timestamp_osm_base": "2018-09-22T05:26:02Z",
|
|
6
|
+
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
|
|
7
|
+
},
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"type": "node",
|
|
11
|
+
"id": 3619112991,
|
|
12
|
+
"lat": 48.9352995,
|
|
13
|
+
"lon": 2.3570684,
|
|
14
|
+
"tags": {
|
|
15
|
+
"information": "map",
|
|
16
|
+
"map_size": "city",
|
|
17
|
+
"map_type": "scheme",
|
|
18
|
+
"tourism": "information"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "node",
|
|
23
|
+
"id": 3682500756,
|
|
24
|
+
"lat": 48.9804426,
|
|
25
|
+
"lon": 2.2719725,
|
|
26
|
+
"tags": {
|
|
27
|
+
"information": "map",
|
|
28
|
+
"level": "0",
|
|
29
|
+
"tourism": "information"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
1
3
|
import pytest
|
|
2
4
|
|
|
3
5
|
|
|
6
|
+
@pytest.fixture(autouse=True)
|
|
7
|
+
def set_timeout(context):
|
|
8
|
+
context.set_default_timeout(int(os.environ.get("PLAYWRIGHT_TIMEOUT", 7500)))
|
|
9
|
+
context.set_default_navigation_timeout(
|
|
10
|
+
int(os.environ.get("PLAYWRIGHT_TIMEOUT", 7500))
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@pytest.fixture(autouse=True)
|
|
15
|
+
def mock_osm_tiles(page):
|
|
16
|
+
if not bool(os.environ.get("PLAYWRIGHT_USE_TILES", False)):
|
|
17
|
+
page.route("*/**/osmfr/**", lambda route: route.fulfill())
|
|
18
|
+
|
|
19
|
+
|
|
4
20
|
@pytest.fixture
|
|
5
21
|
def login(context, settings, live_server):
|
|
6
22
|
def do_login(user):
|
|
@@ -34,7 +34,7 @@ def test_map_load_with_owner(anonymap, live_server, owner_session):
|
|
|
34
34
|
expect(save).to_be_visible()
|
|
35
35
|
add_marker = owner_session.get_by_title("Draw a marker")
|
|
36
36
|
expect(add_marker).to_be_visible()
|
|
37
|
-
edit_settings = owner_session.get_by_title("
|
|
37
|
+
edit_settings = owner_session.get_by_title("Map advanced properties")
|
|
38
38
|
expect(edit_settings).to_be_visible()
|
|
39
39
|
edit_permissions = owner_session.get_by_title("Update permissions and editors")
|
|
40
40
|
expect(edit_permissions).to_be_visible()
|
|
@@ -65,7 +65,7 @@ def test_map_load_with_anonymous_but_editable_layer(
|
|
|
65
65
|
expect(save).to_be_visible()
|
|
66
66
|
add_marker = page.get_by_title("Draw a marker")
|
|
67
67
|
expect(add_marker).to_be_visible()
|
|
68
|
-
edit_settings = page.get_by_title("
|
|
68
|
+
edit_settings = page.get_by_title("Map advanced properties")
|
|
69
69
|
expect(edit_settings).to_be_hidden()
|
|
70
70
|
edit_permissions = page.get_by_title("Update permissions and editors")
|
|
71
71
|
expect(edit_permissions).to_be_hidden()
|
|
@@ -92,6 +92,9 @@ def test_owner_permissions_form(map, datalayer, live_server, owner_session):
|
|
|
92
92
|
".datalayer-permissions select[name='edit_status'] option:checked"
|
|
93
93
|
)
|
|
94
94
|
expect(option).to_have_text("Inherit")
|
|
95
|
+
# Those fields should not be present in anonymous maps
|
|
96
|
+
expect(owner_session.locator(".umap-field-share_status select")).to_be_hidden()
|
|
97
|
+
expect(owner_session.locator(".umap-field-owner")).to_be_hidden()
|
|
95
98
|
|
|
96
99
|
|
|
97
100
|
def test_anonymous_can_add_marker_on_editable_layer(
|
|
@@ -111,12 +114,13 @@ def test_anonymous_can_add_marker_on_editable_layer(
|
|
|
111
114
|
marker = page.locator(".leaflet-marker-icon")
|
|
112
115
|
map_el = page.locator("#map")
|
|
113
116
|
expect(marker).to_have_count(2)
|
|
114
|
-
|
|
117
|
+
panel = page.locator(".panel.right.on")
|
|
118
|
+
expect(panel).to_be_hidden()
|
|
115
119
|
add_marker.click()
|
|
116
120
|
map_el.click(position={"x": 100, "y": 100})
|
|
117
121
|
expect(marker).to_have_count(3)
|
|
118
122
|
# Edit panel is open
|
|
119
|
-
expect(
|
|
123
|
+
expect(panel).to_be_visible()
|
|
120
124
|
datalayer_select = page.locator("select[name='datalayer']")
|
|
121
125
|
expect(datalayer_select).to_be_visible()
|
|
122
126
|
options = page.locator("select[name='datalayer'] option")
|
|
@@ -129,7 +133,7 @@ def test_can_change_perms_after_create(tilelayer, live_server, page):
|
|
|
129
133
|
page.goto(f"{live_server.url}/en/map/new")
|
|
130
134
|
# Create a layer
|
|
131
135
|
page.get_by_title("Manage layers").click()
|
|
132
|
-
page.
|
|
136
|
+
page.get_by_title("Add a layer").click()
|
|
133
137
|
page.locator("input[name=name]").fill("Layer 1")
|
|
134
138
|
save = page.get_by_role("button", name="Save")
|
|
135
139
|
expect(save).to_be_visible()
|
|
@@ -199,3 +203,24 @@ def test_email_sending_error_are_catched(tilelayer, page, live_server):
|
|
|
199
203
|
alert.get_by_role("button", name="Send me the link").click()
|
|
200
204
|
assert patched.called
|
|
201
205
|
expect(alert.get_by_text("Can't send email to foo@bar.com")).to_be_visible()
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
@pytest.mark.skip(reason="Changing DEFAULT_FROM_EMAIL at runtime has no effect")
|
|
209
|
+
def test_alert_message_after_create_show_link_even_without_mail(
|
|
210
|
+
tilelayer, live_server, page, monkeypatch, settings
|
|
211
|
+
):
|
|
212
|
+
# Disable email
|
|
213
|
+
settings.DEFAULT_FROM_EMAIL = None
|
|
214
|
+
page.goto(f"{live_server.url}/en/map/new")
|
|
215
|
+
with page.expect_response(re.compile(r".*/map/create/")):
|
|
216
|
+
page.get_by_role("button", name="Save").click()
|
|
217
|
+
alert = page.locator(".umap-alert")
|
|
218
|
+
expect(alert).to_be_visible()
|
|
219
|
+
expect(
|
|
220
|
+
alert.get_by_text(
|
|
221
|
+
"Your map has been created! As you are not logged in, here is your secret "
|
|
222
|
+
"link to edit the map, please keep it safe:"
|
|
223
|
+
)
|
|
224
|
+
).to_be_visible()
|
|
225
|
+
expect(alert.get_by_role("button", name="Copy")).to_be_visible()
|
|
226
|
+
expect(alert.get_by_role("button", name="Send me the link")).to_be_hidden()
|
|
@@ -45,3 +45,24 @@ def test_create_map_with_cursor(page, live_server, tilelayer):
|
|
|
45
45
|
"z-index: 200;"
|
|
46
46
|
),
|
|
47
47
|
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_cannot_put_script_tag_in_datalayer_name_or_description(
|
|
51
|
+
openmap, live_server, page, tilelayer
|
|
52
|
+
):
|
|
53
|
+
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
|
54
|
+
page.get_by_role("button", name="Edit").click()
|
|
55
|
+
page.get_by_role("link", name="Manage layers").click()
|
|
56
|
+
page.get_by_role("button", name="Add a layer").click()
|
|
57
|
+
page.locator('input[name="name"]').click()
|
|
58
|
+
page.locator('input[name="name"]').fill('<script>alert("attack")</script>')
|
|
59
|
+
page.locator(".umap-field-description textarea").click()
|
|
60
|
+
page.locator(".umap-field-description textarea").fill(
|
|
61
|
+
'<p>before <script>alert("attack")</script> after</p>'
|
|
62
|
+
)
|
|
63
|
+
page.get_by_role("button", name="Save").click()
|
|
64
|
+
page.get_by_role("button", name="About").click()
|
|
65
|
+
# Title should contain raw HTML (we are using textContent)
|
|
66
|
+
expect(page.get_by_text('<script>alert("attack")</script>')).to_be_visible()
|
|
67
|
+
# Description should contain escaped HTML
|
|
68
|
+
expect(page.get_by_text("before after")).to_be_visible()
|
|
@@ -4,8 +4,6 @@ from time import sleep
|
|
|
4
4
|
import pytest
|
|
5
5
|
from playwright.sync_api import expect
|
|
6
6
|
|
|
7
|
-
from umap.models import Map
|
|
8
|
-
|
|
9
7
|
from ..base import DataLayerFactory
|
|
10
8
|
|
|
11
9
|
pytestmark = pytest.mark.django_db
|
|
@@ -65,7 +63,7 @@ def bootstrap(map, live_server):
|
|
|
65
63
|
|
|
66
64
|
def test_data_browser_should_be_open(live_server, page, bootstrap, map):
|
|
67
65
|
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
68
|
-
el = page.locator(".umap-
|
|
66
|
+
el = page.locator(".umap-browser")
|
|
69
67
|
expect(el).to_be_visible()
|
|
70
68
|
expect(page.get_by_text("one point in france")).to_be_visible()
|
|
71
69
|
expect(page.get_by_text("one line in new zeland")).to_be_visible()
|
|
@@ -83,7 +81,7 @@ def test_data_browser_should_be_filterable(live_server, page, bootstrap, map):
|
|
|
83
81
|
expect(filter_).to_be_visible()
|
|
84
82
|
filter_.type("poly")
|
|
85
83
|
expect(page.get_by_title("Features in this layer: 1/3")).to_be_visible()
|
|
86
|
-
expect(page.get_by_title("Features in this layer: 1/3")).to_have_text("1/3")
|
|
84
|
+
expect(page.get_by_title("Features in this layer: 1/3")).to_have_text("(1/3)")
|
|
87
85
|
expect(page.get_by_text("one point in france")).to_be_hidden()
|
|
88
86
|
expect(page.get_by_text("one line in new zeland")).to_be_hidden()
|
|
89
87
|
expect(page.get_by_text("one polygon in greenland")).to_be_visible()
|
|
@@ -161,20 +159,19 @@ def test_data_browser_bbox_filter_should_be_persistent(
|
|
|
161
159
|
el = page.get_by_text("Current map view")
|
|
162
160
|
expect(el).to_be_visible()
|
|
163
161
|
el.click()
|
|
164
|
-
browser = page.locator("
|
|
162
|
+
browser = page.locator(".panel.left.on")
|
|
165
163
|
expect(browser.get_by_text("one point in france")).to_be_visible()
|
|
166
164
|
expect(browser.get_by_text("one line in new zeland")).to_be_hidden()
|
|
167
165
|
expect(browser.get_by_text("one polygon in greenland")).to_be_hidden()
|
|
168
166
|
# Close and reopen the browser to make sure this settings is persistent
|
|
169
|
-
close = browser.
|
|
167
|
+
close = browser.get_by_title("Close")
|
|
170
168
|
close.click()
|
|
171
169
|
expect(browser).to_be_hidden()
|
|
172
170
|
sleep(0.5)
|
|
173
171
|
expect(browser.get_by_text("one point in france")).to_be_hidden()
|
|
174
172
|
expect(browser.get_by_text("one line in new zeland")).to_be_hidden()
|
|
175
173
|
expect(browser.get_by_text("one polygon in greenland")).to_be_hidden()
|
|
176
|
-
page.get_by_title("See
|
|
177
|
-
page.get_by_role("button", name="Browse data").click()
|
|
174
|
+
page.get_by_title("See layers").click()
|
|
178
175
|
expect(browser.get_by_text("one point in france")).to_be_visible()
|
|
179
176
|
expect(browser.get_by_text("one line in new zeland")).to_be_hidden()
|
|
180
177
|
expect(browser.get_by_text("one polygon in greenland")).to_be_hidden()
|
|
@@ -187,7 +184,7 @@ def test_data_browser_bbox_filtered_is_clickable(live_server, page, bootstrap, m
|
|
|
187
184
|
el = page.get_by_text("Current map view")
|
|
188
185
|
expect(el).to_be_visible()
|
|
189
186
|
el.click()
|
|
190
|
-
browser = page.locator("
|
|
187
|
+
browser = page.locator(".panel.left.on")
|
|
191
188
|
expect(browser.get_by_text("one point in france")).to_be_visible()
|
|
192
189
|
expect(browser.get_by_text("one line in new zeland")).to_be_hidden()
|
|
193
190
|
expect(browser.get_by_text("one polygon in greenland")).to_be_hidden()
|
|
@@ -219,18 +216,6 @@ def test_data_browser_with_variable_in_name(live_server, page, bootstrap, map):
|
|
|
219
216
|
expect(page.get_by_text("one polygon in greenland (polygon)")).to_be_visible()
|
|
220
217
|
|
|
221
218
|
|
|
222
|
-
def test_can_open_databrowser_from_layers_list(live_server, map, page, bootstrap):
|
|
223
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
224
|
-
page.get_by_title("See data layers").click()
|
|
225
|
-
page.get_by_role("button", name="Browse data").click()
|
|
226
|
-
browser = page.locator(".umap-browse-data")
|
|
227
|
-
expect(browser).to_be_visible()
|
|
228
|
-
expect(browser.get_by_text("test datalayer")).to_be_visible()
|
|
229
|
-
expect(browser.get_by_text("one point in france")).to_be_visible()
|
|
230
|
-
expect(browser.get_by_text("one line in new zeland")).to_be_visible()
|
|
231
|
-
expect(browser.get_by_text("one polygon in greenland")).to_be_visible()
|
|
232
|
-
|
|
233
|
-
|
|
234
219
|
def test_should_sort_features_in_natural_order(live_server, map, page):
|
|
235
220
|
map.settings["properties"]["onLoadPanel"] = "databrowser"
|
|
236
221
|
map.save()
|
|
@@ -240,20 +225,18 @@ def test_should_sort_features_in_natural_order(live_server, map, page):
|
|
|
240
225
|
datalayer_data["features"][2]["properties"]["name"] = "100. a line"
|
|
241
226
|
DataLayerFactory(map=map, data=datalayer_data)
|
|
242
227
|
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
243
|
-
features = page.locator(".umap-
|
|
228
|
+
features = page.locator(".umap-browser .datalayer li")
|
|
244
229
|
expect(features).to_have_count(3)
|
|
245
230
|
expect(features.nth(0)).to_have_text("1. a poly")
|
|
246
231
|
expect(features.nth(1)).to_have_text("9. a marker")
|
|
247
232
|
expect(features.nth(2)).to_have_text("100. a line")
|
|
248
233
|
|
|
249
234
|
|
|
250
|
-
def test_should_redraw_list_on_feature_delete(live_server,
|
|
251
|
-
|
|
252
|
-
map.save()
|
|
253
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
235
|
+
def test_should_redraw_list_on_feature_delete(live_server, openmap, page, bootstrap):
|
|
236
|
+
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
|
254
237
|
# Enable edit
|
|
255
238
|
page.get_by_role("button", name="Edit").click()
|
|
256
|
-
buttons = page.locator(".umap-
|
|
239
|
+
buttons = page.locator(".umap-browser .datalayer li .icon-delete")
|
|
257
240
|
expect(buttons).to_have_count(3)
|
|
258
241
|
page.on("dialog", lambda dialog: dialog.accept())
|
|
259
242
|
buttons.nth(0).click()
|
|
@@ -269,7 +252,7 @@ def test_should_show_header_for_display_on_load_false(
|
|
|
269
252
|
datalayer.settings["name"] = "This layer is not loaded"
|
|
270
253
|
datalayer.save()
|
|
271
254
|
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
272
|
-
browser = page.locator(".umap-
|
|
255
|
+
browser = page.locator(".umap-browser")
|
|
273
256
|
expect(browser).to_be_visible()
|
|
274
257
|
expect(browser.get_by_text("This layer is not loaded")).to_be_visible()
|
|
275
258
|
|
|
@@ -283,7 +266,7 @@ def test_should_use_color_variable(live_server, map, page):
|
|
|
283
266
|
datalayer_data["features"][2]["properties"]["mycolor"] = "DarkGreen"
|
|
284
267
|
DataLayerFactory(map=map, data=datalayer_data)
|
|
285
268
|
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
286
|
-
features = page.locator(".umap-
|
|
269
|
+
features = page.locator(".umap-browser .datalayer li .feature-color")
|
|
287
270
|
expect(features).to_have_count(3)
|
|
288
271
|
# DarkGreen
|
|
289
272
|
expect(features.nth(0)).to_have_css("background-color", "rgb(0, 100, 0)")
|
|
@@ -299,18 +282,15 @@ def test_should_allow_to_toggle_datalayer_visibility(live_server, map, page, boo
|
|
|
299
282
|
paths = page.locator(".leaflet-overlay-pane path")
|
|
300
283
|
expect(markers).to_have_count(1)
|
|
301
284
|
expect(paths).to_have_count(2)
|
|
302
|
-
toggle = page.locator("
|
|
285
|
+
toggle = page.locator(".umap-browser").get_by_title("Show/hide layer")
|
|
303
286
|
toggle.click()
|
|
304
287
|
expect(markers).to_have_count(0)
|
|
305
288
|
expect(paths).to_have_count(0)
|
|
306
289
|
|
|
307
290
|
|
|
308
|
-
def test_should_have_edit_buttons_in_edit_mode(live_server,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
map.save()
|
|
312
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
313
|
-
browser = page.locator("#umap-ui-container")
|
|
291
|
+
def test_should_have_edit_buttons_in_edit_mode(live_server, openmap, page, bootstrap):
|
|
292
|
+
page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
|
|
293
|
+
browser = page.locator(".umap-browser")
|
|
314
294
|
edit_layer = browser.get_by_title("Edit", exact=True)
|
|
315
295
|
in_table = browser.get_by_title("Edit properties in a table")
|
|
316
296
|
delete_layer = browser.get_by_title("Delete layer")
|