diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-08-31 18:24:38 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-09-01 12:36:46 +0200 |
commit | 3e62918a61fce7910ad70d7beb81b7247b93e575 (patch) | |
tree | b3e3b54ee5fbf5e70854a20bc7c08842a2301617 /ishtar_common/templates/ishtar/blocks/sheet_map.html | |
parent | eaa5572d612e76ea8f55a27ddb7143d3a7385ab3 (diff) | |
download | Ishtar-3e62918a61fce7910ad70d7beb81b7247b93e575.tar.bz2 Ishtar-3e62918a61fce7910ad70d7beb81b7247b93e575.zip |
Put geo map detail in experimental features
Diffstat (limited to 'ishtar_common/templates/ishtar/blocks/sheet_map.html')
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_map.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/ishtar_common/templates/ishtar/blocks/sheet_map.html b/ishtar_common/templates/ishtar/blocks/sheet_map.html new file mode 100644 index 000000000..296516e86 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/sheet_map.html @@ -0,0 +1,62 @@ +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}}; + 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 %} +} +disp_map(); + +{% if geo_item.SLUG == "operation" or geo_item.SLUG == "contextrecord" %} +const disp_geo_items = function(disp_cr, disp_bf, get_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); + } +} +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 = $("#disp-cr-for-{{geo_item.SLUG}}-{{geo_item.pk}}"); +const event_func_disp_geo_items = function () { + if (geo_items_displayed_once) { + disp_map(); + } + else { geo_items_displayed_once = true; } + disp_geo_items(disp_cr.prop('checked'), disp_bf.prop('checked'), get_polygons.val()); +} +disp_cr.change( event_func_disp_geo_items ); +disp_bf.change( event_func_disp_geo_items ); +get_polygons.change( function () { + disp_map(); + disp_geo_items(disp_cr.prop('checked'), disp_bf.prop('checked'), get_polygons.val()); +}) +{% else %} +const event_func_disp_geo_items = function () { + if (geo_items_displayed_once) { + disp_map(); + } + else { geo_items_displayed_once = true; } + disp_geo_items(false, disp_bf.prop('checked'), get_polygons.val()); +} +disp_bf.change( event_func_disp_geo_items ); +get_polygons.change( function () { + disp_map(); + disp_geo_items(false, disp_bf.prop('checked'), get_polygons.val()); +}) +{% endif %} +{% endif %} |