From df1b2612feab3e7c07fd4969fddb91c151ca6bd4 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 24 Feb 2021 14:22:58 +0100 Subject: [PATCH] fixes concatenation, if int --- pygeoapi/templates/collections/items/index.html | 2 +- pygeoapi/templates/collections/items/item.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pygeoapi/templates/collections/items/index.html b/pygeoapi/templates/collections/items/index.html index 746cc5e..390b5c4 100644 --- a/pygeoapi/templates/collections/items/index.html +++ b/pygeoapi/templates/collections/items/index.html @@ -125,7 +125,7 @@ var items = new L.GeoJSON(geojson_data, { onEachFeature: function (feature, layer) { var url = '{{ data['items_path'] }}/' + feature.id + '?f=html'; - var html = '' + feature.id + '. ' + feature['properties']['{{ data['title_field'] }}'] + ''; + var html = '' + {% if data['title_field'] %} feature['properties']['{{ data['title_field'] }}'] {% else %} feature.id {% endif %} + ''; layer.bindPopup(html); } }); diff --git a/pygeoapi/templates/collections/items/item.html b/pygeoapi/templates/collections/items/item.html index 22fc0df..c3ea86f 100644 --- a/pygeoapi/templates/collections/items/item.html +++ b/pygeoapi/templates/collections/items/item.html @@ -1,5 +1,5 @@ {% extends "_base.html" %} -{% set ptitle = data['properties'][data['title_field']] or ("Item " + data['id']) %} +{% set ptitle = data['properties'][data['title_field']] or ("Item {}".format(data['id'])) %} {# Optionally renders an img element, otherwise standard value or link rendering #} {% macro render_item_value(v, width) -%} {% set val = v | string | trim %}