From 8cb3426f8d09a841fbfa476a6f6cf4e77d0bd732 Mon Sep 17 00:00:00 2001 From: Quentin André Date: Thu, 19 Aug 2021 09:43:52 +0200 Subject: test_geo_items works and manual tests work for ui --- .../templates/ishtar/blocks/sheet_simple_map.html | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'ishtar_common/templates/ishtar/blocks/sheet_simple_map.html') diff --git a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html index b44eb5724..a472c8b07 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html @@ -1,5 +1,6 @@ {% if PROFILE.mapping %} {% if geo_item.point_2d or geo_item.multi_polygon %} +{% load ids_display_geo_items %}
@@ -21,23 +22,25 @@ disp_map(); {% if geo_item.SLUG == "operation" or geo_item.SLUG == "contextrecord" %} const disp_geo_items = function(disp_cr, disp_bf, get_polygons) { - const get_poly = (get_polygons === "polygons"); - let url = null; - if (get_poly) { - url = "{% url 'api-get-geo-polygons' %}"; + if (disp_cr || disp_bf) { + const get_poly = (get_polygons === "polygons"); + let url = null; + if (get_poly) { + url = "{% url 'api-get-geo-polygons' %}"; + } + else { + url = "{% url 'api-get-geo-points' %}"; + } + display_geo_items("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", url, "{{geo_item.SLUG}}", + "{{geo_item.pk}}", disp_cr, disp_bf, get_poly); } - else { - url = "{% url 'api-get-geo-points' %}"; - } - display_geo_items("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", url, "{{geo_item.SLUG}}", - "{{geo_item.pk}}", disp_cr, disp_bf, get_poly); } - let geo_items_displayed_once = false; +const disp_bf = $("#disp-bf-for-{{geo_item.SLUG}}-{{geo_item.pk}}"); +const get_polygons = $("#get-poly-for-{{geo_item.SLUG}}-{{geo_item.pk}}"); + {% if geo_item.SLUG == "operation" %} -const disp_cr = $("#display-cr-for-ope"); -const disp_bf = $("#display-bf-for-ope"); -const get_polygons = $("#get-poly-ope"); +const disp_cr = $("#disp-cr-for-{{geo_item.SLUG}}-{{geo_item.pk}}"); const event_func_disp_geo_items = function () { if (geo_items_displayed_once) { disp_map(); @@ -52,8 +55,6 @@ get_polygons.change( function () { disp_geo_items(disp_cr.prop('checked'), disp_bf.prop('checked'), get_polygons.val()); }) {% else %} -const disp_bf = $("#display-bf-for-cr"); -const get_polygons = $("#get-poly-cr"); const event_func_disp_geo_items = function () { if (geo_items_displayed_once) { disp_map(); -- cgit v1.2.3