umap-project 1.12.2__py3-none-any.whl → 1.13.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.
- umap/__init__.py +1 -1
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/br/LC_MESSAGES/django.po +82 -54
- umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- umap/locale/cs_CZ/LC_MESSAGES/django.po +82 -54
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +86 -58
- umap/locale/en/LC_MESSAGES/django.po +79 -51
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +82 -54
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +84 -56
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +108 -80
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.po +82 -54
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.po +82 -54
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +82 -54
- umap/locale/sv/LC_MESSAGES/django.mo +0 -0
- umap/locale/sv/LC_MESSAGES/django.po +82 -54
- umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh_TW/LC_MESSAGES/django.po +86 -58
- umap/models.py +29 -0
- umap/static/umap/base.css +33 -5
- umap/static/umap/content.css +41 -2
- umap/static/umap/img/16.svg +12 -2
- umap/static/umap/img/source/16.svg +165 -820
- umap/static/umap/js/umap.browser.js +9 -3
- umap/static/umap/js/umap.controls.js +45 -217
- umap/static/umap/js/umap.core.js +66 -30
- umap/static/umap/js/umap.forms.js +18 -31
- umap/static/umap/js/umap.icon.js +44 -21
- umap/static/umap/js/umap.js +5 -26
- umap/static/umap/js/umap.layer.js +68 -25
- umap/static/umap/js/umap.popup.js +87 -0
- umap/static/umap/js/umap.share.js +254 -0
- umap/static/umap/js/umap.ui.js +4 -2
- umap/static/umap/locale/am_ET.js +19 -9
- umap/static/umap/locale/am_ET.json +19 -9
- umap/static/umap/locale/ar.js +19 -9
- umap/static/umap/locale/ar.json +19 -9
- umap/static/umap/locale/ast.js +19 -9
- umap/static/umap/locale/ast.json +19 -9
- umap/static/umap/locale/bg.js +19 -9
- umap/static/umap/locale/bg.json +19 -9
- umap/static/umap/locale/br.js +22 -12
- umap/static/umap/locale/br.json +22 -12
- umap/static/umap/locale/ca.js +19 -9
- umap/static/umap/locale/ca.json +19 -9
- umap/static/umap/locale/cs_CZ.js +19 -9
- umap/static/umap/locale/cs_CZ.json +19 -9
- umap/static/umap/locale/da.js +19 -9
- umap/static/umap/locale/da.json +19 -9
- umap/static/umap/locale/de.js +19 -9
- umap/static/umap/locale/de.json +19 -9
- umap/static/umap/locale/el.js +19 -9
- umap/static/umap/locale/el.json +19 -9
- umap/static/umap/locale/en.js +19 -9
- umap/static/umap/locale/en.json +19 -9
- umap/static/umap/locale/en_US.json +19 -9
- umap/static/umap/locale/es.js +19 -9
- umap/static/umap/locale/es.json +19 -9
- umap/static/umap/locale/et.js +19 -9
- umap/static/umap/locale/et.json +19 -9
- umap/static/umap/locale/fa_IR.js +19 -9
- umap/static/umap/locale/fa_IR.json +19 -9
- umap/static/umap/locale/fi.js +19 -9
- umap/static/umap/locale/fi.json +19 -9
- umap/static/umap/locale/fr.js +19 -9
- umap/static/umap/locale/fr.json +19 -9
- umap/static/umap/locale/gl.js +19 -9
- umap/static/umap/locale/gl.json +19 -9
- umap/static/umap/locale/he.js +19 -9
- umap/static/umap/locale/he.json +19 -9
- umap/static/umap/locale/hr.js +19 -9
- umap/static/umap/locale/hr.json +19 -9
- umap/static/umap/locale/hu.js +19 -9
- umap/static/umap/locale/hu.json +19 -9
- umap/static/umap/locale/id.js +19 -9
- umap/static/umap/locale/id.json +19 -9
- umap/static/umap/locale/is.js +19 -9
- umap/static/umap/locale/is.json +19 -9
- umap/static/umap/locale/it.js +19 -9
- umap/static/umap/locale/it.json +19 -9
- umap/static/umap/locale/ja.js +19 -9
- umap/static/umap/locale/ja.json +19 -9
- umap/static/umap/locale/ko.js +19 -9
- umap/static/umap/locale/ko.json +19 -9
- umap/static/umap/locale/lt.js +19 -9
- umap/static/umap/locale/lt.json +19 -9
- umap/static/umap/locale/ms.js +19 -9
- umap/static/umap/locale/ms.json +19 -9
- umap/static/umap/locale/nl.js +19 -9
- umap/static/umap/locale/nl.json +19 -9
- umap/static/umap/locale/no.js +19 -9
- umap/static/umap/locale/no.json +19 -9
- umap/static/umap/locale/pl.js +19 -9
- umap/static/umap/locale/pl.json +19 -9
- umap/static/umap/locale/pl_PL.json +19 -9
- umap/static/umap/locale/pt.js +19 -9
- umap/static/umap/locale/pt.json +19 -9
- umap/static/umap/locale/pt_BR.js +19 -9
- umap/static/umap/locale/pt_BR.json +19 -9
- umap/static/umap/locale/pt_PT.js +19 -9
- umap/static/umap/locale/pt_PT.json +19 -9
- umap/static/umap/locale/ro.js +19 -9
- umap/static/umap/locale/ro.json +19 -9
- umap/static/umap/locale/ru.js +19 -9
- umap/static/umap/locale/ru.json +19 -9
- umap/static/umap/locale/sk_SK.js +19 -9
- umap/static/umap/locale/sk_SK.json +19 -9
- umap/static/umap/locale/sl.js +19 -9
- umap/static/umap/locale/sl.json +19 -9
- umap/static/umap/locale/sr.js +19 -9
- umap/static/umap/locale/sr.json +19 -9
- umap/static/umap/locale/sv.js +19 -9
- umap/static/umap/locale/sv.json +19 -9
- umap/static/umap/locale/th_TH.js +19 -9
- umap/static/umap/locale/th_TH.json +19 -9
- umap/static/umap/locale/tr.js +19 -9
- umap/static/umap/locale/tr.json +19 -9
- umap/static/umap/locale/uk_UA.js +19 -9
- umap/static/umap/locale/uk_UA.json +19 -9
- umap/static/umap/locale/vi.js +19 -9
- umap/static/umap/locale/vi.json +19 -9
- umap/static/umap/locale/vi_VN.json +19 -9
- umap/static/umap/locale/zh.js +19 -9
- umap/static/umap/locale/zh.json +19 -9
- umap/static/umap/locale/zh_CN.json +19 -9
- umap/static/umap/locale/zh_TW.Big5.json +19 -9
- umap/static/umap/locale/zh_TW.js +55 -45
- umap/static/umap/locale/zh_TW.json +55 -45
- umap/static/umap/map.css +76 -9
- umap/static/umap/test/Map.Export.js +3 -3
- umap/static/umap/test/Polygon.js +2 -2
- umap/static/umap/test/Polyline.js +2 -0
- umap/static/umap/test/index.html +1 -0
- umap/static/umap/vendors/leaflet/leaflet-src.esm.js +7055 -7054
- umap/static/umap/vendors/toolbar/leaflet.toolbar-src.js +1 -1
- umap/templates/auth/user_form.html +1 -1
- umap/templates/umap/content.html +1 -1
- umap/templates/umap/js.html +1 -0
- umap/templates/umap/map_list.html +1 -1
- umap/templates/umap/map_table.html +67 -35
- umap/templates/umap/user_dashboard.html +23 -1
- umap/templatetags/umap_tags.py +7 -27
- umap/tests/integration/test_edit_datalayer.py +45 -0
- umap/tests/integration/test_export_map.py +2 -3
- umap/tests/integration/test_facets_browser.py +86 -0
- umap/utils.py +17 -0
- umap/views.py +7 -18
- {umap_project-1.12.2.dist-info → umap_project-1.13.0.dist-info}/METADATA +4 -11
- {umap_project-1.12.2.dist-info → umap_project-1.13.0.dist-info}/RECORD +158 -155
- {umap_project-1.12.2.dist-info → umap_project-1.13.0.dist-info}/WHEEL +0 -0
- {umap_project-1.12.2.dist-info → umap_project-1.13.0.dist-info}/entry_points.txt +0 -0
- {umap_project-1.12.2.dist-info → umap_project-1.13.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{% block maincontent %}
|
|
4
4
|
<div class="col wide">
|
|
5
5
|
<h2 class="section tabs">
|
|
6
|
-
<a href="{% url "user_dashboard" %}">{% trans "My Dashboard" %}</a> | {% trans "My Profile" %}
|
|
6
|
+
<a href="{% url "user_dashboard" %}">{% trans "My Dashboard" %}</a> | <a class="selected" href="{% url 'user_profile' %}">{% trans "My Profile" %}</a>
|
|
7
7
|
</h2>
|
|
8
8
|
</div>
|
|
9
9
|
<div class="wrapper">
|
umap/templates/umap/content.html
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
const container = this.parentNode
|
|
68
68
|
container.innerHTML = data
|
|
69
69
|
Array.prototype.forEach.call(
|
|
70
|
-
container.querySelectorAll('script'),
|
|
70
|
+
container.querySelectorAll('script:not([type="application/json"])'),
|
|
71
71
|
function (item) {
|
|
72
72
|
eval(item.firstChild.textContent)
|
|
73
73
|
}
|
umap/templates/umap/js.html
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
<script src="{{ STATIC_URL }}umap/js/umap.tableeditor.js"></script>
|
|
46
46
|
<script src="{{ STATIC_URL }}umap/js/umap.browser.js"></script>
|
|
47
47
|
<script src="{{ STATIC_URL }}umap/js/umap.importer.js"></script>
|
|
48
|
+
<script src="{{ STATIC_URL }}umap/js/umap.share.js"></script>
|
|
48
49
|
<script src="{{ STATIC_URL }}umap/js/umap.js"></script>
|
|
49
50
|
<script src="{{ STATIC_URL }}umap/js/umap.ui.js"></script>
|
|
50
51
|
{% endcompress %}
|
|
@@ -1,41 +1,73 @@
|
|
|
1
|
-
{% load umap_tags
|
|
1
|
+
{% load umap_tags i18n %}
|
|
2
2
|
<table class="maps">
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</thead>
|
|
14
|
-
{% endif %}
|
|
3
|
+
<thead>
|
|
4
|
+
<tr>
|
|
5
|
+
<th>{% blocktrans %}Name{% endblocktrans %}</th>
|
|
6
|
+
<th>{% blocktrans %}Preview{% endblocktrans %}</th>
|
|
7
|
+
<th>{% blocktrans %}Who can see / edit{% endblocktrans %}</th>
|
|
8
|
+
<th>{% blocktrans %}Last save{% endblocktrans %}</th>
|
|
9
|
+
<th>{% blocktrans %}Owner{% endblocktrans %}</th>
|
|
10
|
+
<th>{% blocktrans %}Actions{% endblocktrans %}</th>
|
|
11
|
+
</tr>
|
|
12
|
+
</thead>
|
|
15
13
|
<tbody>
|
|
16
14
|
{% for map_inst in maps %}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
{% with unique_id="map_"|addstr:map_inst.pk %}
|
|
16
|
+
{{ map_inst.preview_settings|json_script:unique_id }}
|
|
17
|
+
<tr>
|
|
18
|
+
<td>
|
|
19
|
+
<a href="{{ map_inst.get_absolute_url }}">{{ map_inst.name }}</a>
|
|
20
|
+
</td>
|
|
21
|
+
<td>
|
|
22
|
+
<button class="button map-opener neutral" data-map-id="{{ unique_id }}">{% blocktranslate %}Open preview{% endblocktranslate %}</button>
|
|
23
|
+
<dialog>
|
|
24
|
+
<form method="dialog">
|
|
25
|
+
<div id="{{ unique_id }}_target" class="map_fragment"></div>
|
|
26
|
+
<p class="close-dialog">
|
|
27
|
+
<button class="button" type="submit">Close</button>
|
|
28
|
+
</p>
|
|
29
|
+
</form>
|
|
30
|
+
</dialog>
|
|
31
|
+
</td>
|
|
32
|
+
<td>{{ map_inst.get_share_status_display }} / {{ map_inst.get_edit_status_display }}</td>
|
|
33
|
+
<td>{{ map_inst.modified_at }}</td>
|
|
34
|
+
<td>
|
|
35
|
+
<a href="{{ map_inst.owner.get_url }}">{{ map_inst.owner }}</a>
|
|
36
|
+
</td>
|
|
37
|
+
<td>
|
|
38
|
+
<a href="{{ map_inst.get_absolute_url }}?share">{% translate "Share" %}</a> |
|
|
39
|
+
<a href="{{ map_inst.get_absolute_url }}?edit">{% translate "Edit" %}</a> |
|
|
40
|
+
<a href="{% url 'map_download' map_inst.pk %}">{% translate "Download" %}</a>
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
{% endwith %}
|
|
33
44
|
{% endfor %}
|
|
34
45
|
</tbody>
|
|
35
46
|
</table>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<a href="?{%
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
47
|
+
<div class="pagination">
|
|
48
|
+
{% if maps.has_previous %}
|
|
49
|
+
<a href="?p=1{% if q %}&q={{ q }}{% endif %}">« {% translate "first" %}</a>
|
|
50
|
+
<a href="?p={{ maps.previous_page_number }}{% if q %}&q={{ q }}{% endif %}">‹ {% translate "previous" %}</a>
|
|
51
|
+
{% else %}
|
|
52
|
+
{# djlint:off #}
|
|
53
|
+
<span></span>
|
|
54
|
+
<span></span>
|
|
55
|
+
{# djlint:on #}
|
|
56
|
+
{% endif %}
|
|
57
|
+
|
|
58
|
+
<span class="current">
|
|
59
|
+
{% blocktranslate with maps_number=maps.number num_pages=maps.paginator.num_pages %}
|
|
60
|
+
Page {{ maps_number }} of {{ num_pages }}
|
|
61
|
+
{% endblocktranslate %}
|
|
62
|
+
</span>
|
|
63
|
+
|
|
64
|
+
{% if maps.has_next %}
|
|
65
|
+
<a href="?p={{ maps.next_page_number }}{% if q %}&q={{ q }}{% endif %}">{% translate "next" %} ›</a>
|
|
66
|
+
<a href="?p={{ maps.paginator.num_pages }}{% if q %}&q={{ q }}{% endif %}">{% translate "last" %} »</a>
|
|
67
|
+
{% else %}
|
|
68
|
+
{# djlint:off #}
|
|
69
|
+
<span></span>
|
|
70
|
+
<span></span>
|
|
71
|
+
{# djlint:on #}
|
|
72
|
+
{% endif %}
|
|
73
|
+
</div>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{% trans "Search my maps" as placeholder %}
|
|
8
8
|
<div class="col wide">
|
|
9
9
|
<h2 class="section tabs">
|
|
10
|
-
{% trans "My Dashboard" %} | <a href="{% url 'user_profile' %}">{% trans "My profile" %}</a>
|
|
10
|
+
<a class="selected" href="{% url 'user_dashboard' %}">{% trans "My Dashboard" %}</a> | <a href="{% url 'user_profile' %}">{% trans "My profile" %}</a>
|
|
11
11
|
</h2>
|
|
12
12
|
{% include "umap/search_bar.html" with action=request.get_full_path placeholder=placeholder %}
|
|
13
13
|
</div>
|
|
@@ -23,3 +23,25 @@
|
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
{% endblock maincontent %}
|
|
26
|
+
|
|
27
|
+
{% block bottom_js %}
|
|
28
|
+
{{ block.super }}
|
|
29
|
+
<script type="text/javascript">
|
|
30
|
+
!(function () {
|
|
31
|
+
const CACHE = {}
|
|
32
|
+
for (const mapOpener of document.querySelectorAll("button.map-opener")) {
|
|
33
|
+
mapOpener.addEventListener('click', (event) => {
|
|
34
|
+
event.target.nextElementSibling.showModal()
|
|
35
|
+
const mapId = event.target.dataset.mapId
|
|
36
|
+
if (!document.querySelector(`#${mapId}_target`).hasChildNodes()) {
|
|
37
|
+
const previewSettings = JSON.parse(document.getElementById(mapId).textContent)
|
|
38
|
+
const map = new L.U.Map(`${mapId}_target`, previewSettings)
|
|
39
|
+
CACHE[mapId] = map
|
|
40
|
+
} else {
|
|
41
|
+
CACHE[mapId].invalidateSize()
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
})()
|
|
46
|
+
</script>
|
|
47
|
+
{% endblock bottom_js %}
|
umap/templatetags/umap_tags.py
CHANGED
|
@@ -4,9 +4,6 @@ from copy import copy
|
|
|
4
4
|
from django import template
|
|
5
5
|
from django.conf import settings
|
|
6
6
|
|
|
7
|
-
from ..models import DataLayer, TileLayer
|
|
8
|
-
from ..views import _urls_for_js
|
|
9
|
-
|
|
10
7
|
register = template.Library()
|
|
11
8
|
|
|
12
9
|
|
|
@@ -22,30 +19,7 @@ def umap_js(locale=None):
|
|
|
22
19
|
|
|
23
20
|
@register.inclusion_tag("umap/map_fragment.html")
|
|
24
21
|
def map_fragment(map_instance, **kwargs):
|
|
25
|
-
|
|
26
|
-
datalayer_data = [c.metadata() for c in layers]
|
|
27
|
-
map_settings = map_instance.settings
|
|
28
|
-
if "properties" not in map_settings:
|
|
29
|
-
map_settings["properties"] = {}
|
|
30
|
-
map_settings["properties"].update(
|
|
31
|
-
{
|
|
32
|
-
"tilelayers": [TileLayer.get_default().json],
|
|
33
|
-
"datalayers": datalayer_data,
|
|
34
|
-
"urls": _urls_for_js(),
|
|
35
|
-
"STATIC_URL": settings.STATIC_URL,
|
|
36
|
-
"editMode": "disabled",
|
|
37
|
-
"hash": False,
|
|
38
|
-
"attributionControl": False,
|
|
39
|
-
"scrollWheelZoom": False,
|
|
40
|
-
"umapAttributionControl": False,
|
|
41
|
-
"noControl": True,
|
|
42
|
-
"umap_id": map_instance.pk,
|
|
43
|
-
"onLoadPanel": "none",
|
|
44
|
-
"captionBar": False,
|
|
45
|
-
"default_iconUrl": "%sumap/img/marker.png" % settings.STATIC_URL,
|
|
46
|
-
"slideshow": {},
|
|
47
|
-
}
|
|
48
|
-
)
|
|
22
|
+
map_settings = map_instance.preview_settings
|
|
49
23
|
map_settings["properties"].update(kwargs)
|
|
50
24
|
prefix = kwargs.pop("prefix", None) or "map"
|
|
51
25
|
page = kwargs.pop("page", None) or ""
|
|
@@ -86,3 +60,9 @@ def ipdb(what):
|
|
|
86
60
|
|
|
87
61
|
ipdb.set_trace()
|
|
88
62
|
return ""
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@register.filter
|
|
66
|
+
def addstr(arg1, arg2):
|
|
67
|
+
# Necessity: https://stackoverflow.com/a/23783666
|
|
68
|
+
return str(arg1) + str(arg2)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from playwright.sync_api import expect
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_should_have_fieldset_for_layer_type_properties(page, live_server, tilelayer):
|
|
5
|
+
page.goto(f"{live_server.url}/en/map/new/")
|
|
6
|
+
|
|
7
|
+
# Open DataLayers list
|
|
8
|
+
button = page.get_by_title("Manage Layers")
|
|
9
|
+
expect(button).to_be_visible()
|
|
10
|
+
button.click()
|
|
11
|
+
|
|
12
|
+
edit = page.locator("#umap-ui-container").get_by_title("Edit", exact=True)
|
|
13
|
+
expect(edit).to_be_visible()
|
|
14
|
+
edit.click()
|
|
15
|
+
|
|
16
|
+
select = page.locator("#umap-ui-container .umap-field-type select")
|
|
17
|
+
expect(select).to_be_visible()
|
|
18
|
+
|
|
19
|
+
choropleth_header = page.get_by_text("Choropleth: settings")
|
|
20
|
+
heat_header = page.get_by_text("Heatmap: settings")
|
|
21
|
+
cluster_header = page.get_by_text("Clustered: settings")
|
|
22
|
+
expect(choropleth_header).to_be_hidden()
|
|
23
|
+
expect(heat_header).to_be_hidden()
|
|
24
|
+
expect(cluster_header).to_be_hidden()
|
|
25
|
+
|
|
26
|
+
# Switching to Choropleth should add a dedicated fieldset
|
|
27
|
+
select.select_option("Choropleth")
|
|
28
|
+
expect(choropleth_header).to_be_visible()
|
|
29
|
+
expect(heat_header).to_be_hidden()
|
|
30
|
+
expect(cluster_header).to_be_hidden()
|
|
31
|
+
|
|
32
|
+
select.select_option("Heat")
|
|
33
|
+
expect(heat_header).to_be_visible()
|
|
34
|
+
expect(choropleth_header).to_be_hidden()
|
|
35
|
+
expect(cluster_header).to_be_hidden()
|
|
36
|
+
|
|
37
|
+
select.select_option("Cluster")
|
|
38
|
+
expect(cluster_header).to_be_visible()
|
|
39
|
+
expect(choropleth_header).to_be_hidden()
|
|
40
|
+
expect(heat_header).to_be_hidden()
|
|
41
|
+
|
|
42
|
+
select.select_option("Default")
|
|
43
|
+
expect(choropleth_header).to_be_hidden()
|
|
44
|
+
expect(heat_header).to_be_hidden()
|
|
45
|
+
expect(cluster_header).to_be_hidden()
|
|
@@ -9,7 +9,7 @@ pytestmark = pytest.mark.django_db
|
|
|
9
9
|
|
|
10
10
|
def test_umap_export(map, live_server, datalayer, page):
|
|
11
11
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?share")
|
|
12
|
-
link = page.get_by_role("link", name="
|
|
12
|
+
link = page.get_by_role("link", name="full backup")
|
|
13
13
|
expect(link).to_be_visible()
|
|
14
14
|
with page.expect_download() as download_info:
|
|
15
15
|
link.click()
|
|
@@ -73,9 +73,8 @@ def test_umap_export(map, live_server, datalayer, page):
|
|
|
73
73
|
|
|
74
74
|
def test_csv_export(map, live_server, datalayer, page):
|
|
75
75
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?share")
|
|
76
|
-
button = page.get_by_role("button", name="
|
|
76
|
+
button = page.get_by_role("button", name="csv")
|
|
77
77
|
expect(button).to_be_visible()
|
|
78
|
-
page.locator('select[name="format"]').select_option("csv")
|
|
79
78
|
with page.expect_download() as download_info:
|
|
80
79
|
button.click()
|
|
81
80
|
download = download_info.value
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from playwright.sync_api import expect
|
|
3
|
+
|
|
4
|
+
from ..base import DataLayerFactory
|
|
5
|
+
|
|
6
|
+
pytestmark = pytest.mark.django_db
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
DATALAYER_DATA1 = {
|
|
10
|
+
"type": "FeatureCollection",
|
|
11
|
+
"features": [
|
|
12
|
+
{
|
|
13
|
+
"type": "Feature",
|
|
14
|
+
"properties": {"mytype": "even", "name": "Point 2"},
|
|
15
|
+
"geometry": {"type": "Point", "coordinates": [0.065918, 48.385442]},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"type": "Feature",
|
|
19
|
+
"properties": {"mytype": "odd", "name": "Point 1"},
|
|
20
|
+
"geometry": {"type": "Point", "coordinates": [3.55957, 49.767074]},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
"_umap_options": {
|
|
24
|
+
"name": "Calque 1",
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
DATALAYER_DATA2 = {
|
|
30
|
+
"type": "FeatureCollection",
|
|
31
|
+
"features": [
|
|
32
|
+
{
|
|
33
|
+
"type": "Feature",
|
|
34
|
+
"properties": {"mytype": "even", "name": "Point 4"},
|
|
35
|
+
"geometry": {"type": "Point", "coordinates": [0.856934, 45.290347]},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"type": "Feature",
|
|
39
|
+
"properties": {"mytype": "odd", "name": "Point 3"},
|
|
40
|
+
"geometry": {"type": "Point", "coordinates": [4.372559, 47.945786]},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
"_umap_options": {
|
|
44
|
+
"name": "Calque 2",
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@pytest.fixture
|
|
50
|
+
def bootstrap(map, live_server):
|
|
51
|
+
map.settings["properties"]["onLoadPanel"] = "facet"
|
|
52
|
+
map.settings["properties"]["facetKey"] = "mytype|My type"
|
|
53
|
+
map.settings["properties"]["showLabel"] = True
|
|
54
|
+
map.save()
|
|
55
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA1)
|
|
56
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA2)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_simple_facet_search(live_server, page, bootstrap, map):
|
|
60
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
61
|
+
panel = page.locator(".umap-facet-search")
|
|
62
|
+
expect(panel).to_be_visible()
|
|
63
|
+
# Facet name
|
|
64
|
+
expect(page.get_by_text("My type")).to_be_visible()
|
|
65
|
+
# Facet values
|
|
66
|
+
oven = page.get_by_text("even")
|
|
67
|
+
odd = page.get_by_text("odd")
|
|
68
|
+
expect(oven).to_be_visible()
|
|
69
|
+
expect(odd).to_be_visible()
|
|
70
|
+
markers = page.locator(".leaflet-marker-icon")
|
|
71
|
+
expect(markers).to_have_count(4)
|
|
72
|
+
# Tooltips
|
|
73
|
+
expect(page.get_by_text("Point 1")).to_be_visible()
|
|
74
|
+
expect(page.get_by_text("Point 2")).to_be_visible()
|
|
75
|
+
expect(page.get_by_text("Point 3")).to_be_visible()
|
|
76
|
+
expect(page.get_by_text("Point 4")).to_be_visible()
|
|
77
|
+
# Now let's filter
|
|
78
|
+
odd.click()
|
|
79
|
+
expect(markers).to_have_count(2)
|
|
80
|
+
expect(page.get_by_text("Point 2")).to_be_hidden()
|
|
81
|
+
expect(page.get_by_text("Point 4")).to_be_hidden()
|
|
82
|
+
expect(page.get_by_text("Point 1")).to_be_visible()
|
|
83
|
+
expect(page.get_by_text("Point 3")).to_be_visible()
|
|
84
|
+
# Now let's filter
|
|
85
|
+
odd.click()
|
|
86
|
+
expect(markers).to_have_count(4)
|
umap/utils.py
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import gzip
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
|
+
from django.conf import settings
|
|
4
5
|
from django.urls import URLPattern, URLResolver, get_resolver
|
|
5
6
|
|
|
6
7
|
|
|
8
|
+
def _urls_for_js(urls=None):
|
|
9
|
+
"""
|
|
10
|
+
Return templated URLs prepared for javascript.
|
|
11
|
+
"""
|
|
12
|
+
if urls is None:
|
|
13
|
+
# prevent circular import
|
|
14
|
+
from .urls import i18n_urls, urlpatterns
|
|
15
|
+
|
|
16
|
+
urls = [
|
|
17
|
+
url.name for url in urlpatterns + i18n_urls if getattr(url, "name", None)
|
|
18
|
+
]
|
|
19
|
+
urls = dict(zip(urls, [get_uri_template(url) for url in urls]))
|
|
20
|
+
urls.update(getattr(settings, "UMAP_EXTRA_URLS", {}))
|
|
21
|
+
return urls
|
|
22
|
+
|
|
23
|
+
|
|
7
24
|
def get_uri_template(urlname, args=None, prefix=""):
|
|
8
25
|
"""
|
|
9
26
|
Utility function to return an URI Template from a named URL in django
|
umap/views.py
CHANGED
|
@@ -62,7 +62,7 @@ from .forms import (
|
|
|
62
62
|
UserProfileForm,
|
|
63
63
|
)
|
|
64
64
|
from .models import DataLayer, Licence, Map, Pictogram, Star, TileLayer
|
|
65
|
-
from .utils import ConflictError,
|
|
65
|
+
from .utils import ConflictError, _urls_for_js, gzip_file, is_ajax, merge_features
|
|
66
66
|
|
|
67
67
|
User = get_user_model()
|
|
68
68
|
|
|
@@ -270,7 +270,12 @@ class UserDashboard(PaginatorMixin, DetailView, SearchMixin):
|
|
|
270
270
|
|
|
271
271
|
def get_context_data(self, **kwargs):
|
|
272
272
|
kwargs.update(
|
|
273
|
-
{
|
|
273
|
+
{
|
|
274
|
+
"q": self.request.GET.get("q"),
|
|
275
|
+
"maps": self.paginate(
|
|
276
|
+
self.get_maps(), settings.UMAP_MAPS_PER_PAGE_OWNER
|
|
277
|
+
),
|
|
278
|
+
}
|
|
274
279
|
)
|
|
275
280
|
return super().get_context_data(**kwargs)
|
|
276
281
|
|
|
@@ -390,22 +395,6 @@ ajax_proxy = AjaxProxy.as_view()
|
|
|
390
395
|
# ############## #
|
|
391
396
|
|
|
392
397
|
|
|
393
|
-
def _urls_for_js(urls=None):
|
|
394
|
-
"""
|
|
395
|
-
Return templated URLs prepared for javascript.
|
|
396
|
-
"""
|
|
397
|
-
if urls is None:
|
|
398
|
-
# prevent circular import
|
|
399
|
-
from .urls import i18n_urls, urlpatterns
|
|
400
|
-
|
|
401
|
-
urls = [
|
|
402
|
-
url.name for url in urlpatterns + i18n_urls if getattr(url, "name", None)
|
|
403
|
-
]
|
|
404
|
-
urls = dict(zip(urls, [get_uri_template(url) for url in urls]))
|
|
405
|
-
urls.update(getattr(settings, "UMAP_EXTRA_URLS", {}))
|
|
406
|
-
return urls
|
|
407
|
-
|
|
408
|
-
|
|
409
398
|
def simple_json_response(**kwargs):
|
|
410
399
|
return HttpResponse(json.dumps(kwargs), content_type="application/json")
|
|
411
400
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: umap-project
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.13.0
|
|
4
4
|
Summary: Create maps with OpenStreetMap layers in a minute and embed them in your site.
|
|
5
5
|
Author-email: Yohan Boniface <yb@enix.org>
|
|
6
6
|
Maintainer-email: David Larlet <david@larlet.fr>
|
|
@@ -48,19 +48,12 @@ Requires-Dist: pytest-xdist<4,>=3.5.0; extra == 'test'
|
|
|
48
48
|
Requires-Dist: pytest==6.2.5; extra == 'test'
|
|
49
49
|
Description-Content-Type: text/markdown
|
|
50
50
|
|
|
51
|
-
|
|
52
51
|
# uMap project
|
|
53
52
|
|
|
54
|
-
[](https://requires.io/github/umap-project/umap/requirements/?branch=master)
|
|
55
|
-
[](https://gitter.im/umap-project/umap?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](http://umap-project.readthedocs.io/en/master/?badge=latest)[](https://travis-ci.org/umap-project/umap)
|
|
56
|
-
|
|
57
|
-
## About
|
|
58
|
-
|
|
59
53
|
uMap lets you create maps with OpenStreetMap layers in a minute and embed them in your site.
|
|
60
54
|
*Because we think that the more OSM will be used, the more OSM will be improved.*
|
|
61
55
|
Built on top of Django and Leaflet.
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
See [developer documentation](https://umap-project.readthedocs.io/en/master/install/).
|
|
57
|
+
- Have a look at [our website](https://umap-project.org) for an introduction
|
|
58
|
+
- See [our docs](https://docs.umap-project.org/) for technical information
|
|
59
|
+
- Come [chat with us on matrix.org](https://app.element.io/#/room/#umap:matrix.org), or join [the mailing-list](https://lists.openstreetmap.org/listinfo/umap)
|