From 6bb5c7149607074eafcca2d6fdaa5492daa2534d Mon Sep 17 00:00:00 2001 From: paul van genuchten Date: Mon, 22 Feb 2021 00:53:34 +0100 Subject: [PATCH] this restores nesting which was lost on latest commits of #637 (#643) plus truncates large fields in list display --- pygeoapi/templates/collections/items/index.html | 10 +++++----- pygeoapi/templates/collections/items/item.html | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pygeoapi/templates/collections/items/index.html b/pygeoapi/templates/collections/items/index.html index a55c47c..635bce4 100644 --- a/pygeoapi/templates/collections/items/index.html +++ b/pygeoapi/templates/collections/items/index.html @@ -88,13 +88,13 @@ {% for ft in data['features'] %} - {{ ft.id }} + {{ ft.id | truncate( 12 ) }} {% if data['title_field'] %} - {{ ft['properties'][data['title_field']] }} + {{ ft['properties'][data['title_field']] | truncate( 35 ) }} {% endif %} {% for k, v in ft['properties'].items() %} - {% if loop.index < 5 and k != data['id_field'] and k != data['title_field'] %} - {{ v | urlize(20) }} + {% if loop.index < 5 and k not in [data['id_field'], data['title_field'], 'extent'] %} + {{ v | truncate( 35 ) }} {% endif %} {% endfor %} @@ -121,7 +121,7 @@ attribution: '{{ config['server']['map']['attribution'] }}' } )); - var geojson_data = {{ data['features'] |to_json }}; + var geojson_data = {{ data['features'] | to_json }}; var items = new L.GeoJSON(geojson_data, { onEachFeature: function (feature, layer) { var url = '{{ data['items_path'] }}/' + feature.id + '?f=html'; diff --git a/pygeoapi/templates/collections/items/item.html b/pygeoapi/templates/collections/items/item.html index 195567a..22fc0df 100644 --- a/pygeoapi/templates/collections/items/item.html +++ b/pygeoapi/templates/collections/items/item.html @@ -6,7 +6,7 @@ {% if val|length and val.lower().endswith(('.jpg', '.jpeg', '.png', '.gif', '.bmp')) %} {# Ends with image extension: render img element with link to image #} {{ val.split('/') | last }} - {% elif v is string, boolean, integer, float, number %} + {% elif v is string or v is boolean or v is integer or v is float or v is number %} {{ val | urlize() | wordwrap() }} {% elif v is mapping %} {# this is a dict #}