Skip to content

Commit

Permalink
Update HTML pages (#7)
Browse files Browse the repository at this point in the history
* Add titles to configuration

* Update HTML ref
  • Loading branch information
webb-ben committed Aug 31, 2023
1 parent e479352 commit 6efa8be
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ <h6 class="m-0 font-weight-bold text-primary">

var items = new L.GeoJSON(geojson_data, {
onEachFeature: function (feature, layer) {
{% if data.get('uri_field') -%}
var url = feature['properties']['{{ data['uri_field'] }}'];
{%- else -%}
var url = '{{ data['items_path'] }}/' + feature.id + '?f=html';
{%- endif %}
var html = '<span><a href="' + url + '">' + {% if data['title_field'] %} feature['properties']['{{ data['title_field'] }}'] {% else %} feature.id {% endif %} + '</a></span>';
layer.bindPopup(html);
}
Expand Down
12 changes: 5 additions & 7 deletions pygeoapi-skin-dashboard/templates/collections/items/item.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
{%- endmacro %}
{% block title %}{{ ptitle }} - {{ super() }}{% endblock %}
{% block crumbs %}{{ super() }}
/ <a href="../../../collections">Collections</a>
{% for link in data['links'] %}
{% if link.rel == 'collection' %}
/ <a href="{{ link['href'] }}">{{ link['title'] | truncate( 25 ) }}</a>
{% endif %}
{% endfor %}
/ <a href="../items">Items</a>
{% if data.get('uri_field') -%}
{% set uri = data.properties[data.uri_field] %}
/ <a href="{{ uri }}">{{ uri }}</a>
{%- else -%}
/ <a href="./{{ data['id'] }}">{{ ptitle | truncate( 25 ) }}</a>
{%- endif %}
{% endblock %}
{% block extrahead %}
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
Expand Down
18 changes: 18 additions & 0 deletions pygeoapi.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ resources:
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
id_field: huc2
title_field: name
table: hu02
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -145,6 +146,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: huc4
title_field: name
table: hu04
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -174,6 +176,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: huc6
title_field: name
table: hu06
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -203,6 +206,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: huc8
title_field: name
table: hu08
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -232,6 +236,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: huc10
title_field: name
table: hu10
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -275,6 +280,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: nat_aqfr_cd
title_field: aq_name
table: nat_aq
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -310,6 +316,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: aq_code
title_field: aq_name
table: princi_aq
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -348,6 +355,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: id
title_field: shr
table: sec_hydrg_reg
uri_field: uri
geom_field: geom
Expand All @@ -372,6 +380,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: id
title_field: description
table: ref_gages
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -399,6 +408,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: id
title_field: name_at_outlet
table: mainstems
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -432,6 +442,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: id
title_field: description
table: ref_dams
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -479,6 +490,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: pwsid
title_field: pws_name
table: ref_pws
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -513,6 +525,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: geoid
title_field: name
table: states
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -547,6 +560,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: geoid
title_field: name
table: counties
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -574,6 +588,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: geoid
title_field: name
table: aiannh
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -601,6 +616,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: geoid
title_field: name
table: cbsa
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -631,6 +647,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: geoid10
title_field: name10
table: ua10
uri_field: uri
geom_field: geom
Expand Down Expand Up @@ -665,6 +682,7 @@ resources:
name: PostgreSQL
data: *provider-data
id_field: geoid
title_field: name
table: places
uri_field: uri
geom_field: geom
Expand Down

0 comments on commit 6efa8be

Please sign in to comment.