diff options
author | QuentinAndre <quentin.andre@imt-atlantique.net> | 2021-07-26 18:41:53 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:48 +0200 |
commit | 499c5e4ee6cb3a47526798de55a5c00ca468d039 (patch) | |
tree | 50cf810937c40eed0d144dfb964308a54c94ef7d /ishtar_common/templates | |
parent | 2a8d2108f9d87f62db245895cc716e90f2225af6 (diff) | |
download | Ishtar-499c5e4ee6cb3a47526798de55a5c00ca468d039.tar.bz2 Ishtar-499c5e4ee6cb3a47526798de55a5c00ca468d039.zip |
fixes urls import
Diffstat (limited to 'ishtar_common/templates')
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_geo_items.html | 12 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_simple_map.html | 61 |
2 files changed, 35 insertions, 38 deletions
diff --git a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html index 451453d59..9b485de15 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html @@ -6,8 +6,12 @@ <label for="display-geo-items">{% trans "Display associated features: " %}</label> <select name="display-geo-items" id="display-geo-items"> <option value="" selected="selected">{% trans "None" %}</option> + {% if geo_item.SLUG == "operation" %} <option id="disp-context-records" value="contextrecords">{% trans "Context records" %}</option> + <option value="basefinds">{% trans "Everything" %}</option> + {% else %} <option value="basefinds">{% trans "Base finds" %}</option> + {% endif %} </select> </dd> <dd> @@ -19,14 +23,6 @@ </dd> </dl> <script> -var hide_context_records = function() { - if ("{{geo_item.SLUG}}" === "contextrecord") { - const disp_cr = $("#disp-context-records")[0]; - disp_cr.hidden = true; - } -} -hide_context_records(); - var hide_get_polygons = function() { const disp = $("#display-geo-items")[0]; const get_poly = $("#get-polygons")[0]; 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 %} |