From a239633fae10dc29174e3b23133e7ff92dc7435f Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 12 Feb 2024 10:17:57 +0100 Subject: [PATCH 01/43] feat: change threshold to switch black SVG img to white --- umap/static/umap/js/umap.core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index 092018d3..ba6a7118 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -410,7 +410,8 @@ L.DomUtil.contrastedColor = (el, bgcolor) => { rgb = L.DomUtil.RGBRegex.exec(rgb) if (!rgb || rgb.length !== 4) return out rgb = parseInt(rgb[1], 10) + parseInt(rgb[2], 10) + parseInt(rgb[3], 10) - if (rgb < (255 * 3) / 2) out = 1 + const threshold = 140 + if (rgb < threshold * 3) out = 1 if (bgcolor) _CACHE_CONSTRAST[bgcolor] = out return out } From b420f6d9f2f8608a26aad3c2766517d5d5652d7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 17:22:36 +0000 Subject: [PATCH 02/43] chore: bump ruff from 0.2.0 to 0.2.1 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.2.0 to 0.2.1. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.2.0...v0.2.1) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6c35b6ac..aa432b34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ dependencies = [ [project.optional-dependencies] dev = [ "hatch==1.9.3", - "ruff==0.2.0", + "ruff==0.2.1", "djlint==1.34.1", "mkdocs==1.5.3", "mkdocs-material==9.5.7", From 7073d30548f21ae07a7d5c91176ca77ef904a90c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 17:22:42 +0000 Subject: [PATCH 03/43] chore: bump isort from 5.12 to 5.13.2 Bumps [isort](https://github.com/pycqa/isort) from 5.12 to 5.13.2. - [Release notes](https://github.com/pycqa/isort/releases) - [Changelog](https://github.com/PyCQA/isort/blob/main/CHANGELOG.md) - [Commits](https://github.com/pycqa/isort/compare/5.12.0...5.13.2) --- updated-dependencies: - dependency-name: isort dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6c35b6ac..75a7c76b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ dev = [ "mkdocs-material==9.5.7", "vermin==1.6.0", "pymdown-extensions==10.7", - "isort==5.12", + "isort==5.13.2", ] test = [ "factory-boy==3.2.1", From 9426570b6e2bc0968accd05620164d3102bff12d Mon Sep 17 00:00:00 2001 From: David Larlet Date: Mon, 12 Feb 2024 15:42:49 -0500 Subject: [PATCH 04/43] fix: encode the whole url parameter for OEmbed See https://github.com/umap-project/umap/pull/1526#issuecomment-1937040472 --- umap/templates/umap/map_detail.html | 2 +- umap/tests/test_map_views.py | 2 +- umap/views.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/umap/templates/umap/map_detail.html b/umap/templates/umap/map_detail.html index 22f272c5..fd57fc8b 100644 --- a/umap/templates/umap/map_detail.html +++ b/umap/templates/umap/map_detail.html @@ -17,7 +17,7 @@ {% umap_js locale=locale %} {% if object.share_status != object.PUBLIC %}{% endif %} {% endblock extra_head %} {% block content %} diff --git a/umap/tests/test_map_views.py b/umap/tests/test_map_views.py index 2670cecf..8f0ccae3 100644 --- a/umap/tests/test_map_views.py +++ b/umap/tests/test_map_views.py @@ -815,6 +815,6 @@ def test_oembed_link(client, map, datalayer): ) assert ( 'href="http://testserver/map/oembed/' - f'?url=http%3A//testserver/en/map/test-map_{map.id}&format=json"' + f'?url=http%3A%2F%2Ftestserver%2Fen%2Fmap%2Ftest-map_{map.id}&format=json"' ) in response.content.decode() assert 'title="test map oEmbed URL" />' in response.content.decode() diff --git a/umap/views.py b/umap/views.py index cfdeee87..467cb36c 100644 --- a/umap/views.py +++ b/umap/views.py @@ -10,7 +10,7 @@ from http.client import InvalidURL from io import BytesIO from pathlib import Path from urllib.error import HTTPError, URLError -from urllib.parse import quote, urlparse +from urllib.parse import quote, quote_plus, urlparse from urllib.request import Request, build_opener from django.conf import settings @@ -595,8 +595,8 @@ class MapView(MapDetailMixin, PermissionsMixin, DetailView): context["oembed_absolute_uri"] = self.request.build_absolute_uri( reverse("map_oembed") ) - context["absolute_uri"] = self.request.build_absolute_uri( - self.object.get_absolute_url() + context["quoted_absolute_uri"] = quote_plus( + self.request.build_absolute_uri(self.object.get_absolute_url()) ) return context From 4f469ced47c6a95e32acd4c0ec005a5bd8f34ec7 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Mon, 12 Feb 2024 20:59:35 -0500 Subject: [PATCH 05/43] fix: improve dashboard styles --- umap/static/umap/content.css | 14 ++++++++++---- umap/static/umap/nav.css | 1 + umap/templates/umap/map_table.html | 12 ++++++------ umap/templates/umap/navigation.html | 10 +++++----- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/umap/static/umap/content.css b/umap/static/umap/content.css index bade8061..e986c097 100644 --- a/umap/static/umap/content.css +++ b/umap/static/umap/content.css @@ -158,6 +158,7 @@ h2.tabs a { text-decoration: underline; text-decoration-thickness: 3px; text-decoration-skip-ink: none; + text-underline-offset: 7px; margin-right: 2rem; } h2.tabs a:not(.selected) { @@ -439,8 +440,15 @@ ul.umap-autocomplete { width: 100%; } .table-wrapper table a, -.table-wrapper table thead { +.table-wrapper table thead tr th, +.table-wrapper table th[scope="row"] { color: #263B58; + text-align: left; + padding-left: 2px; +} +.table-wrapper table thead tr th { + line-height: 1.2; + padding: 10px 5px; } .table-wrapper table thead th:last-of-type { min-width: 240px; @@ -476,9 +484,6 @@ ul.umap-autocomplete { .table-wrapper table tbody tr:nth-child(odd) { background-color: #f4f4f4; } -.table-wrapper table td { - text-align: center; -} .table-wrapper table thead tr { line-height: 2em; } @@ -515,6 +520,7 @@ dialog::backdrop { display: flex; flex-direction: row; justify-content: space-around; + margin-bottom: 3rem; } .pagination > * { padding: 1rem; diff --git a/umap/static/umap/nav.css b/umap/static/umap/nav.css index 1cb46488..3c754d3f 100644 --- a/umap/static/umap/nav.css +++ b/umap/static/umap/nav.css @@ -66,6 +66,7 @@ footer .i18n_switch { .umap-nav .button:hover { text-decoration: none; min-width: 150px; + margin-left: 1rem; } @media only screen and (min-width: 500px) { diff --git a/umap/templates/umap/map_table.html b/umap/templates/umap/map_table.html index 1a0b87c7..56309a4c 100644 --- a/umap/templates/umap/map_table.html +++ b/umap/templates/umap/map_table.html @@ -16,9 +16,9 @@ {% for map_inst in maps %} {% with unique_id="map_"|addstr:map_inst.pk %} - + {{ map_inst.name }} - + {{ map_inst.preview_settings|json_script:unique_id }}