8
8
{%- from "components/entity-field/macro.jinja" import entityField %}
9
9
{%- from "components/back-button/macro.jinja" import dlBackButton %}
10
10
11
+ {% if row['geometry'] %}
12
+ {% set truncated_geometry = row['geometry'][:10000] %}
13
+ {% set full_geometry = row['geometry'] %}
14
+ {% else %}
15
+ {% set truncated_geometry = "" %}
16
+ {% set full_geometry = "" %}
17
+ {% endif %}
18
+
19
+
20
+
21
+
22
+
11
23
{% if row['name'] %}
12
24
{%- set row_name = row['name'] %}
13
25
{%- elif row['reference'] %}
@@ -71,19 +83,30 @@ <h1 class="govuk-heading-xl">{{ row_name }}</h1>
71
83
</ thead >
72
84
< tbody class ="govuk-table__body ">
73
85
{% for field in row.keys() %}
74
- {% if field != 'entity' and field != 'geometry' %}
75
- {%- if field not in ["geometry","point","organisation-entity","json"] or row[field] is not none %}
76
- < tr class ="govuk-table__row ">
77
- < th scope ="row " class ="app-table__header app-table__header--row ">
78
- {{ entityField(field,fields,dataset_fields) }}
79
- </ th >
80
- < td class ="govuk-table__cell app-table__cell ">
81
- {{ entityValue(field,row[field],fields,dataset_fields,organisation_entity,linked_entities)}}
82
- </ td >
83
- {% if field is not in['dataset','organisation-entity','start-date','end-date','typology'] %}
84
- < td class ="govuk-table__cell govuk-!-font-size-14 govuk-!-text-align-right ">
85
- < a href ="/fact?dataset={{row['dataset']}}&entity={{row['entity']}}&field={{field}} " class ="govuk-link "> Facts</ a >
86
- </ td >
86
+ {% if field != 'entity'%}
87
+ {%- if field not in ["geometry","point","organisation-entity","json"] or row[field] is not none %}
88
+ < tr class ="govuk-table__row ">
89
+ < th scope ="row " class ="app-table__header app-table__header--row ">
90
+ {{ entityField(field, fields, dataset_fields) }}
91
+ </ th >
92
+ < td class ="govuk-table__cell app-table__cell ">
93
+ {% if field == 'geometry' %}
94
+ < code class ="app-code-block " id ="geometry-content ">
95
+ {% if row[field] is not none %}
96
+ {{ row[field][:10000] }}{% if row[field]|length > 10000 %}... < a href ="javascript:void(0); " onclick ="expandGeometry() "> Load More</ a > {% endif %}
97
+ {% endif %}
98
+ </ code >
99
+ < code class ="app-code-block " id ="geometry-full-content " style ="display: none; ">
100
+ {{ row[field] }}
101
+ </ code >
102
+ {% else %}
103
+ {{ entityValue(field, row[field], fields, dataset_fields, organisation_entity, linked_entities) }}
104
+ {% endif %}
105
+ </ td >
106
+ {% if field not in ['dataset', 'organisation-entity', 'start-date', 'end-date', 'typology'] %}
107
+ < td class ="govuk-table__cell govuk-!-font-size-14 govuk-!-text-align-right ">
108
+ < a href ="/fact?dataset={{ row['dataset'] }}&entity={{ row['entity'] }}&field={{ field }} " class ="govuk-link "> Facts</ a >
109
+ </ td >
87
110
{% else %}
88
111
< td class ="govuk-table__cell govuk-!-font-size-14 govuk-!-text-align-right "> < span class ='govuk-visually-hidden '> no fact link</ span > </ td >
89
112
{% endif %}
@@ -92,11 +115,18 @@ <h1 class="govuk-heading-xl">{{ row_name }}</h1>
92
115
{% endif %}
93
116
{% endfor %}
94
117
</ tbody >
118
+ < script >
119
+ function expandGeometry ( ) {
120
+ document . getElementById ( 'geometry-content' ) . style . display = 'none' ;
121
+ document . getElementById ( 'geometry-full-content' ) . style . display = 'block' ;
122
+ }
123
+ </ script >
124
+
95
125
</ table >
96
126
{% endcall %}
97
127
98
128
{% set jsonHTML %}
99
- < pre class ="govuk-!-margin-0 "> < code class ="language-json app-code-block app-code-block-overflow " tabindex ="0 "> </ code > </ pre >
129
+ < pre class ="govuk-!-margin-0 "> < code class ="language-json app-code-block app-code-block-overflow " tabindex ="0 "> {{ row | digital_land_to_json | safe }} </ code > </ pre >
100
130
{% endset %}
101
131
{% set geojsonHTML %}
102
132
< pre class ="govuk-!-margin-0 "> < code class ="language-json app-code-block app-code-block-overflow " id ="geojson-content " tabindex ="0 "> Loading...</ code > </ pre >
@@ -340,6 +370,8 @@ <h3 class="govuk-heading-s">{{ type|capitalize }}</h3>
340
370
341
371
{%- block pageScripts %}
342
372
373
+
374
+
343
375
< script >
344
376
document . addEventListener ( 'DOMContentLoaded' , function ( ) {
345
377
// Function to handle loading GeoJSON content
0 commit comments