From 44c24bf02835323d5418512ebe8e76166739ebf8 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 30 Jul 2022 23:52:17 +0200 Subject: [PATCH] Refs #25706 -- Removed inline CSS in the openlayers widget template. --- django/contrib/gis/static/gis/css/ol3.css | 8 ++++++++ django/contrib/gis/static/gis/js/OLMapWidget.js | 3 +++ django/contrib/gis/templates/gis/openlayers.html | 14 ++++---------- docs/releases/4.2.txt | 4 ++++ tests/gis_tests/geoadmin/tests.py | 4 ++-- tests/gis_tests/test_geoforms.py | 4 ++-- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/django/contrib/gis/static/gis/css/ol3.css b/django/contrib/gis/static/gis/css/ol3.css index 9c8a9f5e06..ac8f0a8ec2 100644 --- a/django/contrib/gis/static/gis/css/ol3.css +++ b/django/contrib/gis/static/gis/css/ol3.css @@ -1,3 +1,11 @@ +.dj_map_wrapper { + position: relative; + float: left; +} +html[dir="rtl"] .dj_map_wrapper { + float: right; +} + .switch-type { background-repeat: no-repeat; cursor: pointer; diff --git a/django/contrib/gis/static/gis/js/OLMapWidget.js b/django/contrib/gis/static/gis/js/OLMapWidget.js index 9dea7d05aa..839c8cd7cc 100644 --- a/django/contrib/gis/static/gis/js/OLMapWidget.js +++ b/django/contrib/gis/static/gis/js/OLMapWidget.js @@ -61,6 +61,9 @@ class MapWidget { this.options.base_layer = new ol.layer.Tile({source: new ol.source.OSM()}); } + const mapContainer = document.getElementById(this.options.map_id); + mapContainer.style.width = `${mapContainer.dataset.width}px`; + mapContainer.style.height = `${mapContainer.dataset.height}px`; this.map = this.createMap(); this.featureCollection = new ol.Collection(); this.featureOverlay = new ol.layer.Vector({ diff --git a/django/contrib/gis/templates/gis/openlayers.html b/django/contrib/gis/templates/gis/openlayers.html index fa336469b8..bde2650ca2 100644 --- a/django/contrib/gis/templates/gis/openlayers.html +++ b/django/contrib/gis/templates/gis/openlayers.html @@ -1,17 +1,11 @@ {% load i18n l10n %} - -
-
+
+
{% if not disabled %}{% translate "Delete all Features" %}{% endif %} {% if display_raw %}

{% translate "Debugging window (serialized value)" %}

{% endif %} - +