From e25fb5d04f54fca6f2cfd35eee8eb437c8f0e504 Mon Sep 17 00:00:00 2001 From: Brian DeRocher Date: Wed, 20 Sep 2023 12:48:32 -0400 Subject: [PATCH] Add FeaturesHaveOwners map option. WIP --- umap/settings/base.py | 1 + umap/static/umap/js/umap.js | 8 ++++++++ umap/views.py | 1 + 3 files changed, 10 insertions(+) diff --git a/umap/settings/base.py b/umap/settings/base.py index 6c1a84d7..86b50fe1 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -249,6 +249,7 @@ DATABASES = { } UMAP_DEFAULT_SHARE_STATUS = None UMAP_DEFAULT_EDIT_STATUS = None +UMAP_DEFAULT_FEATURES_HAVE_OWNERS = True UMAP_READONLY = env('UMAP_READONLY', default=False) UMAP_GZIP = True diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 27414e33..18641b9f 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -108,6 +108,7 @@ L.U.Map.include({ L.Util.setBooleanFromQueryString(this.options, 'displayCaptionOnLoad') L.Util.setBooleanFromQueryString(this.options, 'captionBar') L.Util.setBooleanFromQueryString(this.options, 'captionMenus') + L.Util.setBooleanFromQueryString(this.options, 'featuresHaveOwners') for (let i = 0; i < this.HIDDABLE_CONTROLS.length; i++) { L.Util.setNullableBooleanFromQueryString( this.options, @@ -1112,6 +1113,7 @@ L.U.Map.include({ 'filterKey', 'facetKey', 'slugKey', + 'featuresHaveOwners', 'showLabel', 'labelDirection', 'labelInteractive', @@ -1457,6 +1459,12 @@ L.U.Map.include({ label: L._('Feature identifier key'), }, ], + [ + 'options.featuesHaveOwners', + { + handler: 'Switch', label: L._('Features have owners') + }, + ], ] builder = new L.U.FormBuilder(this, optionsFields, { diff --git a/umap/views.py b/umap/views.py index f33296d9..58c02797 100644 --- a/umap/views.py +++ b/umap/views.py @@ -509,6 +509,7 @@ class MapDetailMixin: "properties": { "zoom": getattr(settings, "LEAFLET_ZOOM", 6), "datalayers": [], + "features_have_owners": settings.UMAP_DEFAULT_FEATURES_HAVE_OWNERS, }, }