summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar/blocks/sheet_geo_items.html
blob: 451453d59054ed0af70bd7775309f1b1f1014597 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{% load i18n window_field %}{% if PROFILE.mapping %}
{% if geo_item.point_2d or geo_item.multi_polygon %}
<dl class="col-12">
    <dt>{% trans "Display geo items" %}</dt>
    <dd>
        <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>
            <option id="disp-context-records" value="contextrecords">{% trans "Context records" %}</option>
            <option value="basefinds">{% trans "Base finds" %}</option>
        </select>
    </dd>
    <dd>
        <label for="get-polygons" id="label-get-polygons">{% trans "Geometry: " %}</label>
        <select name="get-polygons" id="get-polygons">
            <option value="polygons" selected="selected">{% trans "Display polygons" %}</option>
            <option value="points">{% trans "Display points" %}</option>
        </select>
    </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];
    const label = $("#label-get-polygons")[0];
    get_poly.hidden = true;
    label.hidden = true;
    disp.addEventListener('change', (event) => {
        if (event.target.value === "") {
            get_poly.hidden = true;
            label.hidden = true;
            get_poly.value = "";
        } else { get_poly.hidden = false;
            label.hidden = false;}
    })
}
hide_get_polygons();
</script>
{% endif %}
{% endif %}