From d05e9a9ae34bd844d3ba575f5d22ce06b773d3e7 Mon Sep 17 00:00:00 2001 From: Maxime Bouveron Date: Fri, 26 Jan 2024 18:02:39 +0100 Subject: [PATCH] Add option to deactivate search in layers --- project/locales/en/LC_MESSAGES/django.po | 5 ++++- project/locales/fr/LC_MESSAGES/django.po | 7 ++++++- project/settings/__init__.py | 6 ++++++ project/visu/api.py | 1 + project/visu/tests/test_api.py | 2 ++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/project/locales/en/LC_MESSAGES/django.po b/project/locales/en/LC_MESSAGES/django.po index 09e0ec4e..5ec7b5a2 100644 --- a/project/locales/en/LC_MESSAGES/django.po +++ b/project/locales/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-21 09:53+0000\n" +"POT-Creation-Date: 2024-01-31 15:45+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -214,6 +214,9 @@ msgstr "" msgid "Define custom MapboxDraw style for the distance measure control" msgstr "" +msgid "Enable search in layers in the search bar map control" +msgstr "" + msgid "Enable search in locations in the search bar map control" msgstr "" diff --git a/project/locales/fr/LC_MESSAGES/django.po b/project/locales/fr/LC_MESSAGES/django.po index 47a71fc9..ee359b34 100644 --- a/project/locales/fr/LC_MESSAGES/django.po +++ b/project/locales/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-11-21 09:53+0000\n" +"POT-Creation-Date: 2024-01-31 15:45+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -227,6 +227,11 @@ msgid "Define custom MapboxDraw style for the distance measure control" msgstr "" "Définissez un style spécifique pour le contrôle des mesures sur la carte." +msgid "Enable search in layers in the search bar map control" +msgstr "" +"Active la recherche dans les couches via le contrôle de recherche sur la " +"carte." + msgid "Enable search in locations in the search bar map control" msgstr "Active la recherche par lieu sur la carte." diff --git a/project/settings/__init__.py b/project/settings/__init__.py index 4d7e44ef..8b0e4828 100644 --- a/project/settings/__init__.py +++ b/project/settings/__init__.py @@ -310,6 +310,11 @@ _("Define custom MapboxDraw style for the distance measure control"), "json_field", ), + "SEARCH_IN_LAYERS": ( + True, + _("Enable search in layers in the search bar map control"), + bool, + ), "SEARCH_IN_LOCATIONS": ( False, _("Enable search in locations in the search bar map control"), @@ -393,6 +398,7 @@ "OPENID_DEFAULT_LOGIN_BUTTON_TEXT", "MEASURE_CONTROL", "MEASURE_DRAW_STYLES", + "SEARCH_IN_LAYERS", "SEARCH_IN_LOCATIONS", "SEARCH_IN_LOCATIONS_PROVIDER", "NOMINATIM_URL", diff --git a/project/visu/api.py b/project/visu/api.py index 9959f0a7..d6653cf1 100644 --- a/project/visu/api.py +++ b/project/visu/api.py @@ -161,6 +161,7 @@ def get(self, request, *args, **kwargs): "enable": config.MEASURE_CONTROL, "styles": config.MEASURE_DRAW_STYLES, }, + "searchInLayers": config.SEARCH_IN_LAYERS, "searchInLocations": { "enable": config.SEARCH_IN_LOCATIONS, "searchProvider": self._get_search_provider_config(), diff --git a/project/visu/tests/test_api.py b/project/visu/tests/test_api.py index dfe01178..4b7f532c 100644 --- a/project/visu/tests/test_api.py +++ b/project/visu/tests/test_api.py @@ -47,6 +47,7 @@ def test_default_values(self): "enable": False, "styles": [], }, + "searchInLayers": True, "searchInLocations": { "enable": False, "searchProvider": {"provider": "Nominatim", "options": {}}, @@ -108,6 +109,7 @@ def test_custom(self): "enable": False, "styles": [], }, + "searchInLayers": True, "searchInLocations": { "enable": True, "searchProvider": {