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-09-01 12:36:46 +0200
commit5f1ccd67fbeb5fc1fe69765b639ce6bddb70e988 (patch)
tree6fbdd8e9f10363b27c73216becb12cd1c6a4e9b5 /ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
parenta1abf9cd4ae5a736026e2e47d3add324dd3e461b (diff)
downloadIshtar-5f1ccd67fbeb5fc1fe69765b639ce6bddb70e988.tar.bz2
Ishtar-5f1ccd67fbeb5fc1fe69765b639ce6bddb70e988.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 %}