summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
diff options
context:
space:
mode:
authorQuentinAndre <quentin.andre@imt-atlantique.net>2021-07-26 18:41:53 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-10-25 12:06:02 +0200
commitf74c43040a9ad2f7fac9cd16dc76f1bcdc533962 (patch)
tree7dca909dd23f241e506e4e27a82f533d981db260 /ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
parent0bc2a87a78c770dd511ec4e2856fc8500cae4e7b (diff)
downloadIshtar-f74c43040a9ad2f7fac9cd16dc76f1bcdc533962.tar.bz2
Ishtar-f74c43040a9ad2f7fac9cd16dc76f1bcdc533962.zip
fixes urls import
Diffstat (limited to 'ishtar_common/templates/ishtar/blocks/sheet_simple_map.html')
-rw-r--r--ishtar_common/templates/ishtar/blocks/sheet_simple_map.html61
1 files changed, 31 insertions, 30 deletions
diff --git a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
index b475e7343..2c9d49be2 100644
--- a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
+++ b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
@@ -19,40 +19,41 @@ var disp_map = function() {
}
disp_map();
-if ("{{geo_item.SLUG}}" === 'contextrecord' || "{{geo_item.SLUG}}" === 'operation') {
- 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;
- if (get_polygons === "Points") {
- url = "{% url 'archaeological_finds:api-get-geo-points' %}";
- }
- else {
- url = "{% url 'archaeological_finds:api-get-geo-polygons' %}";
- }
- disp_geo_items("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", url, "{{geo_item.SLUG}}", "{{geo_item.pk}}", display_both);
+{% 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");
+ 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);
+}
- var geo_items_displayed_once = false;
- var disp = $("#display-geo-items")[0];
- var get_polygons = $("#get-polygons")[0];
- disp.addEventListener('change', (event) => {
- if (geo_items_displayed_once) {
- disp_map();
- }
- if (disp.value !== "") {
- console.log("geo items");
- display_geo_items(disp.value, get_polygons.value);
- geo_items_displayed_once = true;
- }
- })
- get_polygons.addEventListener('change', (event) => {
+var geo_items_displayed_once = false;
+var disp = $("#display-geo-items")[0];
+var get_polygons = $("#get-polygons")[0];
+disp.addEventListener('change', (event) => {
+ if (geo_items_displayed_once) {
disp_map();
+ }
+ if (disp.value !== "") {
display_geo_items(disp.value, get_polygons.value);
- })
-}
+ geo_items_displayed_once = true;
+ }
+})
+get_polygons.addEventListener('change', (event) => {
+ disp_map();
+ display_geo_items(disp.value, get_polygons.value);
+})
+{% endif %}
</script>
{% endif %}
{% endif %}