From 256d6c631c048fba356f5814bf8d1d0032cde6e9 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 29 Jan 2024 12:24:16 +0100 Subject: [PATCH] feat: use svg for default icon (circle) fix #1560 --- umap/models.py | 2 +- umap/static/umap/img/marker.svg | 4 ++++ umap/static/umap/test/_pre.js | 2 +- umap/tests/integration/test_picto.py | 6 +++--- umap/views.py | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 umap/static/umap/img/marker.svg diff --git a/umap/models.py b/umap/models.py index c74e7c0e..d63f00fd 100644 --- a/umap/models.py +++ b/umap/models.py @@ -216,7 +216,7 @@ class Map(NamedModel): "umap_id": self.pk, "onLoadPanel": "none", "captionBar": False, - "default_iconUrl": "%sumap/img/marker.png" % settings.STATIC_URL, + "default_iconUrl": "%sumap/img/marker.svg" % settings.STATIC_URL, "slideshow": {}, } ) diff --git a/umap/static/umap/img/marker.svg b/umap/static/umap/img/marker.svg new file mode 100644 index 00000000..9b579a76 --- /dev/null +++ b/umap/static/umap/img/marker.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/umap/static/umap/test/_pre.js b/umap/static/umap/test/_pre.js index 22e519c2..30d407d3 100644 --- a/umap/static/umap/test/_pre.js +++ b/umap/static/umap/test/_pre.js @@ -132,7 +132,7 @@ function initMap(options) { map_update_permissions: '/map/{map_id}/update/permissions/', map_download: '/map/{map_id}/download/', }, - default_iconUrl: '../src/img/marker.png', + default_iconUrl: '../src/img/marker.svg', zoom: 6, share_statuses: [ [1, 'Tout le monde (public)'], diff --git a/umap/tests/integration/test_picto.py b/umap/tests/integration/test_picto.py index 673c0c9c..96048b08 100644 --- a/umap/tests/integration/test_picto.py +++ b/umap/tests/integration/test_picto.py @@ -46,7 +46,7 @@ def test_can_change_picto_at_map_level(map, live_server, page, pictos): marker = page.locator(".umap-div-icon img") expect(marker).to_have_count(1) # Should have default img - expect(marker).to_have_attribute("src", "/static/umap/img/marker.png") + expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg") edit_settings = page.get_by_title("Edit map properties") expect(edit_settings).to_be_visible() edit_settings.click() @@ -66,7 +66,7 @@ def test_can_change_picto_at_map_level(map, live_server, page, pictos): symbols.click() expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg") undefine.click() - expect(marker).to_have_attribute("src", "/static/umap/img/marker.png") + expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg") def test_can_change_picto_at_datalayer_level(map, live_server, page, pictos): @@ -147,7 +147,7 @@ def test_can_use_remote_url_as_picto(map, live_server, page, pictos): marker = page.locator(".umap-div-icon img") expect(marker).to_have_count(1) # Should have default img - expect(marker).to_have_attribute("src", "/static/umap/img/marker.png") + expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg") edit_settings = page.get_by_title("Edit map properties") expect(edit_settings).to_be_visible() edit_settings.click() diff --git a/umap/views.py b/umap/views.py index 4561fadf..30e57a27 100644 --- a/umap/views.py +++ b/umap/views.py @@ -428,7 +428,7 @@ class MapDetailMixin: "urls": _urls_for_js(), "tilelayers": TileLayer.get_list(), "editMode": self.edit_mode, - "default_iconUrl": "%sumap/img/marker.png" % settings.STATIC_URL, # noqa + "default_iconUrl": "%sumap/img/marker.svg" % settings.STATIC_URL, # noqa "umap_id": self.get_umap_id(), "starred": self.is_starred(), "licences": dict((l.name, l.json) for l in Licence.objects.all()),