summaryrefslogtreecommitdiff
path: root/ishtar_common/templates
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-09-09 12:38:46 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:18 +0100
commit767ae393b1cf53b2b79b5b71ff2654f2ac00678c (patch)
tree44dd6b9849a9bdfbfb6b1c22c78cf3ad0992d7c6 /ishtar_common/templates
parentab20bc79939e4a7e7f77d6c2263dd9836d30654b (diff)
downloadIshtar-767ae393b1cf53b2b79b5b71ff2654f2ac00678c.tar.bz2
Ishtar-767ae393b1cf53b2b79b5b71ff2654f2ac00678c.zip
Geo: display associated context records and associated finds on sheet map (refactor and fixes)
Diffstat (limited to 'ishtar_common/templates')
-rw-r--r--ishtar_common/templates/ishtar/blocks/sheet_map.html46
1 files changed, 23 insertions, 23 deletions
diff --git a/ishtar_common/templates/ishtar/blocks/sheet_map.html b/ishtar_common/templates/ishtar/blocks/sheet_map.html
index 11780ae8a..4a380ed13 100644
--- a/ishtar_common/templates/ishtar/blocks/sheet_map.html
+++ b/ishtar_common/templates/ishtar/blocks/sheet_map.html
@@ -9,40 +9,40 @@
<h4>{% trans "Geographic data" %}</h4>
<ul>{% for geodata in geodata_list %}
<li>
- <input type="checkbox" name="map-ol-{{item.SLUG}}-{{item.pk}}-{{geodata.pk}}"
- class="map-ol-{{item.SLUG}}-{{item.pk}}"
- id="map-ol-{{item.SLUG}}-{{item.pk}}-{{geodata.pk}}"
+ <input type="checkbox" name="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-{{geodata.pk}}"
+ class="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}"
+ id="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-{{geodata.pk}}"
{% if not forloop.counter0 %}checked{% endif %}
>
- &nbsp; <label for="map-ol-{{item.SLUG}}-{{item.pk}}-{{geodata.pk}}">
+ &nbsp; <label for="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-{{geodata.pk}}">
<strong>{{geodata.data_type}}</strong></label><br/>
{{geodata.name}}
</li>{% endfor %}
- {% if geo_item.SLUG == "operation" %}
+ {% if geo_item.SLUG == "operation" and display_context_records %}
<li>
- <input type="checkbox" name="map-ol-{{item.SLUG}}-{{item.pk}}-crs"
- class="map-ol-{{item.SLUG}}-{{item.pk}}"
- id="map-ol-{{item.SLUG}}-{{item.pk}}-crs">
- &nbsp; <label for="map-ol-{{item.SLUG}}-{{item.pk}}-crs">
+ <input type="checkbox" name="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-crs"
+ class="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}"
+ id="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-crs">
+ &nbsp; <label for="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-crs">
<strong>{% trans "Associated context records" %}</strong></label>
</li>
{% endif %}
- {% if geo_item.SLUG == "operation" or geo_item.SLUG == "contextrecord" %}
+ {% if display_finds %}{% if geo_item.SLUG == "operation" or geo_item.SLUG == "contextrecord" %}
<li>
- <input type="checkbox" name="map-ol-{{item.SLUG}}-{{item.pk}}-finds"
- class="map-ol-{{item.SLUG}}-{{item.pk}}"
- id="map-ol-{{item.SLUG}}-{{item.pk}}-finds">
- &nbsp; <label for="map-ol-{{item.SLUG}}-{{item.pk}}-finds">
+ <input type="checkbox" name="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-finds"
+ class="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}"
+ id="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-finds">
+ &nbsp; <label for="map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}-finds">
<strong>{% trans "Associated finds" %}</strong></label>
</li>
- {% endif %}
+ {% endif %}{% endif %}
</ul>
</div>
<script type="text/javascript">
-const refresh_map_{{item.SLUG}}_{{item.pk}} = function(first_init) {
- let idx = "{{item.SLUG}}-{{item.pk}}";
+const refresh_map_{{geo_item.SLUG}}_{{geo_item.pk}} = function(first_init) {
+ let idx = "{{geo_item.SLUG}}-{{geo_item.pk}}";
let geodata_list = { {% for geodata in geodata_list %}
- "{{item.SLUG}}-{{item.pk}}-{{geodata.pk}}": ["{{geodata.geometry_type}}", {{geodata.geojson|safe}}]{% if not forloop.last %},{% endif %}
+ "{{geo_item.SLUG}}-{{geo_item.pk}}-{{geodata.pk}}": ["{{geodata.geometry_type}}", {{geodata.geojson|safe}}]{% if not forloop.last %},{% endif %}
{% endfor %} };
let url{% if geo_item.SLUG == "operation" or geo_item.SLUG == "contextrecord" %} = "{% url 'api-get-geo' %}"{% endif %};
let attrs{% if geo_item.SLUG == "operation" %} = {"operation_id": "{{geo_item.pk}}"}{% elif geo_item.SLUG == "contextrecord" %} = {"context_record_id": "{{geo_item.pk}}"}{% endif %};
@@ -51,19 +51,19 @@ const refresh_map_{{item.SLUG}}_{{item.pk}} = function(first_init) {
display_points("map-{{window_id}}-" + idx, _geo_points[idx], first_init);
}
-const display_map_{{item.SLUG}}_{{item.pk}} = function() {
+const display_map_{{geo_item.SLUG}}_{{geo_item.pk}} = 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);
display_map("map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}", null, null);
- $(".map-ol-{{item.SLUG}}-{{item.pk}}").change(
+ $(".map-ol-{{geo_item.SLUG}}-{{geo_item.pk}}").change(
function(){
- refresh_map_{{item.SLUG}}_{{item.pk}}(false);
+ refresh_map_{{geo_item.SLUG}}_{{geo_item.pk}}(false);
}
);
}
-display_map_{{item.SLUG}}_{{item.pk}}();
-refresh_map_{{item.SLUG}}_{{item.pk}}(true);
+display_map_{{geo_item.SLUG}}_{{geo_item.pk}}();
+refresh_map_{{geo_item.SLUG}}_{{geo_item.pk}}(true);
</script>