From bb4c027ec7a3bb4bce74bea7fcf2617073cdddfc Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 12 Jul 2023 09:14:24 +0200 Subject: [PATCH] Allow to use http://umap.fr/map/xxxx?share to open shareBox on load That way is more consistent with ?download and ?edit --- umap/static/umap/js/umap.js | 4 ++-- umap/templates/umap/map_table.html | 2 +- umap/tests/test_views.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 1eadc11c..5f8224c8 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -251,10 +251,10 @@ L.U.Map.include({ } this.initShortcuts() this.onceDatalayersLoaded(function () { - if (this.options.onLoadPanel === 'databrowser') this.openBrowser() + if (L.Util.queryString('share')) this.renderShareBox() + else if (this.options.onLoadPanel === 'databrowser') this.openBrowser() else if (this.options.onLoadPanel === 'caption') this.displayCaption() else if (this.options.onLoadPanel === 'datafilters') this.openFilter() - else if (this.options.onLoadPanel === 'share') this.renderShareBox() }) this.onceDataLoaded(function () { const slug = L.Util.queryString('feature') diff --git a/umap/templates/umap/map_table.html b/umap/templates/umap/map_table.html index 0e4cf947..43d8e9a5 100644 --- a/umap/templates/umap/map_table.html +++ b/umap/templates/umap/map_table.html @@ -20,7 +20,7 @@ {{ map_inst.owner }} - {% translate "Share" %} + {% translate "Share" %} {% translate "Edit" %} {% translate "Download" %} diff --git a/umap/tests/test_views.py b/umap/tests/test_views.py index 8adb8ebf..f8522d39 100644 --- a/umap/tests/test_views.py +++ b/umap/tests/test_views.py @@ -257,5 +257,5 @@ def test_user_dashboard_display_user_maps(client, map): body = response.content.decode() assert map.name in body assert f"{map.get_absolute_url()}?edit" in body - assert f"{map.get_absolute_url()}?onLoadPanel=share" in body + assert f"{map.get_absolute_url()}?share" in body assert f"{map.get_absolute_url()}?download" in body