diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-03-16 11:36:15 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:21:00 +0100 |
commit | 3e0a73401c1307baf8813bb87eb9f94f8e3a44f1 (patch) | |
tree | c04bf0b7c237eed0920799a2330e11dd05661737 /ishtar_common/templates | |
parent | 6803fa0cb2d70eb90591ec318d9733ddea387315 (diff) | |
download | Ishtar-3e0a73401c1307baf8813bb87eb9f94f8e3a44f1.tar.bz2 Ishtar-3e0a73401c1307baf8813bb87eb9f94f8e3a44f1.zip |
Geodata: fix templates with geovectordata
Diffstat (limited to 'ishtar_common/templates')
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_map.html | 16 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_simple_map.html | 24 |
2 files changed, 13 insertions, 27 deletions
diff --git a/ishtar_common/templates/ishtar/blocks/sheet_map.html b/ishtar_common/templates/ishtar/blocks/sheet_map.html index 296516e86..e0278b8c7 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_map.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_map.html @@ -1,11 +1,18 @@ +{% if PROFILE.mapping and geo_item.main_geodata %} +<div class="col-12 col-lg-6 flex-wrap"> + <div class="window-map" id="map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}"> + </div> + <div id="map-content-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}"></div> +</div> +<script type="text/javascript"> + const disp_map = function() { const html = render_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", false, true); $("#map-content-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}").html(html); - {% if geo_item.most_precise_geo == 'point' %} - const {{geo_item.SLUG}}{{geo_item.pk}} = {{geo_item.point_2d_geojson|safe}}; + const {{geo_item.SLUG}}{{geo_item.pk}} = {{geo_item.main_geodata.geojson|safe}}; + {% if geo_item.main_geodata.geometry_type == 'POINT' %} display_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", {{geo_item.SLUG}}{{geo_item.pk}}); {% else %} - const {{geo_item.SLUG}}{{geo_item.pk}} = {{geo_item.multi_polygon_geojson|safe}}; display_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", null, {{geo_item.SLUG}}{{geo_item.pk}}); {% endif %} } @@ -60,3 +67,6 @@ get_polygons.change( function () { }) {% endif %} {% endif %} + +</script> +{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html deleted file mode 100644 index 93035862f..000000000 --- a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html +++ /dev/null @@ -1,24 +0,0 @@ -{% if PROFILE.mapping %} -{% if geo_item.point_2d or geo_item.multi_polygon %} -<div class="col-12 col-lg-6 flex-wrap"> -<div class="window-map" id="map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}"> -</div> -<div id="map-content-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}"></div> -</div> -<script type="text/javascript"> -{% if PROFILE.experimental_feature %} -{% include "ishtar/blocks/sheet_map.html" %} -{% else %} -var html = render_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", false, true); -$("#map-content-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}").html(html); -{% if geo_item.most_precise_geo == 'point' %} -var {{geo_item.SLUG}}{{geo_item.pk}} = {{geo_item.point_2d_geojson|safe}}; -display_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", {{geo_item.SLUG}}{{geo_item.pk}}); -{% else %} -var {{geo_item.SLUG}}{{geo_item.pk}} = {{geo_item.multi_polygon_geojson|safe}}; -display_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", null, {{geo_item.SLUG}}{{geo_item.pk}}); -{% endif %} -{% endif %} -</script> -{% endif %} -{% endif %} |