summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/templates/ishtar/blocks/sheet_simple_map.html')
-rw-r--r--ishtar_common/templates/ishtar/blocks/sheet_simple_map.html62
1 files changed, 36 insertions, 26 deletions
diff --git a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
index e8a33ae68..b44eb5724 100644
--- a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
+++ b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
@@ -6,57 +6,67 @@
<div id="map-content-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}"></div>
</div>
<script type="text/javascript">
-var disp_map = function() {
- var html = render_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", false, true);
+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' %}
- var {{geo_item.SLUG}}{{geo_item.pk}} = {{geo_item.point_2d_geojson|safe}};
+ 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 %}
- var {{geo_item.SLUG}}{{geo_item.pk}} = {{geo_item.multi_polygon_geojson|safe}};
+ 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" %}
-var display_geo_items = function(disp, get_polygons) {
- var display_both = false;
- if ((disp === "basefinds") && ("{{geo_item.SLUG}}" === "operation")) {
- display_both = true;
- }
- var url = null;
- var get_poly = (get_polygons === "polygons");
+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' %}";
}
else {
url = "{% url 'api-get-geo-points' %}";
}
- disp_geo_items("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", url, "{{geo_item.SLUG}}",
- "{{geo_item.pk}}", display_both, get_poly);
+ 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);
}
-var geo_items_displayed_once = false;
-var disp = $("#display-geo-items");
-var get_polygons = $("#get-polygons");
-disp.change( function () {
+let geo_items_displayed_once = false;
+{% 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 event_func_disp_geo_items = function () {
if (geo_items_displayed_once) {
disp_map();
}
- if (disp.val() !== "") {
- display_geo_items(disp.val(), get_polygons.val());
- geo_items_displayed_once = true;
- }
+ 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 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();
+ }
+ 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();
- display_geo_items(disp.val(), get_polygons.val());
+ disp_geo_items(false, disp_bf.prop('checked'), get_polygons.val());
})
-console.log('points with base points');
-display_associated_points("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}",
- {{geo_item.point_2d_geojson|safe}}, "{{geo_item.SLUG}}");
-
+{% endif %}
{% endif %}
</script>
{% endif %}