summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar
diff options
context:
space:
mode:
authorQuentinAndre <quentin.andre@imt-atlantique.net>2021-08-19 09:43:52 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-10-25 12:06:03 +0200
commit37e6eea122752e8af1a6535f0e236ecb09bc27fc (patch)
treee3819c3cafd675f6437c308df5465561cd2d1b31 /ishtar_common/templates/ishtar
parent99c7437151c203a952e71e49ed567f6bc8a705fd (diff)
downloadIshtar-37e6eea122752e8af1a6535f0e236ecb09bc27fc.tar.bz2
Ishtar-37e6eea122752e8af1a6535f0e236ecb09bc27fc.zip
test_geo_items works and manual tests work for ui
Diffstat (limited to 'ishtar_common/templates/ishtar')
-rw-r--r--ishtar_common/templates/ishtar/blocks/sheet_geo_items.html43
-rw-r--r--ishtar_common/templates/ishtar/blocks/sheet_simple_map.html31
2 files changed, 29 insertions, 45 deletions
diff --git a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html
index 3d76a5aa5..1c45b5d9f 100644
--- a/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html
+++ b/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html
@@ -1,60 +1,43 @@
{% load i18n window_field %}{% if PROFILE.mapping %}
{% if geo_item.point_2d or geo_item.multi_polygon %}
+{% load ids_display_geo_items %}
<dl class="col-12">
<dt>{% trans "Display geo items" %}</dt>
<dd>
<fieldset>
{% if geo_item.SLUG == "operation" %}
- <input type="checkbox" name="display-cr-for-ope" id="display-cr-for-ope">
- <label for="display-cr-for-ope">{% trans "Display context records" %}</label>
- <input type="checkbox" name="display-bf-for-ope" id="display-bf-for-ope">
- <label for="display-bf-for-ope">{% trans "Display base finds" %}</label>
- {% else %}
- <input type="checkbox" name="display-bf-for-cr" id="display-bf-for-cr">
- <label for="display-bf-for-cr">{% trans "Display base finds" %}</label>
+ <input type="checkbox" id="disp-cr-for-{{geo_item.SLUG}}-{{geo_item.pk}}">
+ <label for="disp-cr-for-{{geo_item.SLUG}}-{{geo_item.pk}}">{% trans "Display context records" %}</label>
{% endif %}
+ <input type="checkbox" id="disp-bf-for-{{geo_item.SLUG}}-{{geo_item.pk}}">
+ <label for="disp-bf-for-{{geo_item.SLUG}}-{{geo_item.pk}}">{% trans "Display base finds" %}</label>
</fieldset>
</dd>
<dd>
- {% if geo_item.SLUG == "operation" %}
- <label for="get-poly-ope" id="label-get-poly-ope">{% trans "Geometry: " %}</label>
- <select name="get-poly-ope" id="get-poly-ope">
+ <label for="get-poly-for-{{geo_item.SLUG}}-{{geo_item.pk}}" id="get-poly-label-for-{{geo_item.SLUG}}-{{geo_item.pk}}">{% trans "Geometry: " %}</label>
+ <select id="get-poly-for-{{geo_item.SLUG}}-{{geo_item.pk}}">
<option value="polygons" selected="selected">{% trans "Display polygons" %}</option>
<option value="points">{% trans "Display points" %}</option>
</select>
- {% else %}
- <label for="get-poly-cr" id="label-get-poly-cr">{% trans "Geometry: " %}</label>
- <select name="get-poly-cr" id="get-poly-cr">
- <option value="polygons" selected="selected">{% trans "Display polygons" %}</option>
- <option value="points">{% trans "Display points" %}</option>
- </select>
- {% endif %}
</dd>
</dl>
<script>
const hide_get_polygons = function() {
- {% if geo_item.SLUG == "operation" %}
- const disp_cr = $("#display-cr-for-ope");
- const disp_bf = $("#display-bf-for-ope");
- const get_poly = $("#get-poly-ope");
- const label = $("#label-get-poly-ope");
- {% else %}
- const disp_cr = null;
- const disp_bf = $("#display-bf-for-cr");
- const get_poly = $("#get-poly-cr");
- const label = $("#label-get-poly-cr");
- {% endif %}
+ const disp_cr = $("#disp-cr-for-{{geo_item.SLUG}}-{{geo_item.pk}}");
+ const disp_bf = $("#disp-bf-for-{{geo_item.SLUG}}-{{geo_item.pk}}");
+ const get_poly = $("#get-poly-for-{{geo_item.SLUG}}-{{geo_item.pk}}");
+ const label = $("#get-poly-label-for-{{geo_item.SLUG}}-{{geo_item.pk}}");
get_poly.hide();
label.hide();
const display_get_poly = function () {
- if (disp_bf.prop('checked') || ((disp_cr != null) && disp_cr.prop('checked'))) {
+ if (disp_bf.prop('checked') || ((disp_cr.length > 0) && disp_cr.prop('checked'))) {
get_poly.show();
label.show();
} else {
get_poly.hide();
label.hide();}
}
- if (disp_cr != null) {
+ if (disp_cr.length > 0) {
disp_cr.change( display_get_poly );
}
disp_bf.change( display_get_poly )
diff --git a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
index b44eb5724..a472c8b07 100644
--- a/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
+++ b/ishtar_common/templates/ishtar/blocks/sheet_simple_map.html
@@ -1,5 +1,6 @@
{% if PROFILE.mapping %}
{% if geo_item.point_2d or geo_item.multi_polygon %}
+{% load ids_display_geo_items %}
<div class="col-12 col-lg-6 flex-wrap">
<div class="window-map" id="map-{{window_id}}-{{geo_item.SLUG}}-{{geo_item.pk}}">
</div>
@@ -21,23 +22,25 @@ disp_map();
{% if geo_item.SLUG == "operation" or geo_item.SLUG == "contextrecord" %}
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' %}";
+ if (disp_cr || disp_bf) {
+ 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' %}";
+ }
+ 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);
}
- else {
- url = "{% url 'api-get-geo-points' %}";
- }
- 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);
}
-
let geo_items_displayed_once = false;
+const disp_bf = $("#disp-bf-for-{{geo_item.SLUG}}-{{geo_item.pk}}");
+const get_polygons = $("#get-poly-for-{{geo_item.SLUG}}-{{geo_item.pk}}");
+
{% 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 disp_cr = $("#disp-cr-for-{{geo_item.SLUG}}-{{geo_item.pk}}");
const event_func_disp_geo_items = function () {
if (geo_items_displayed_once) {
disp_map();
@@ -52,8 +55,6 @@ get_polygons.change( function () {
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();