Skip to content

Commit 81b9fe1

Browse files
authored
Merge pull request #1204 from geopython/issue-1203
fix temporal display and contacts on item HTML (#1203) (#1205)
2 parents d029352 + 50dedde commit 81b9fe1

File tree

1 file changed

+63
-31
lines changed

1 file changed

+63
-31
lines changed

pycsw/templates/item.html

Lines changed: 63 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -89,32 +89,60 @@ <h2>{{ data.get('properties',{}).get('title',data['id']) }}</h2>
8989
{% endfor %}
9090
</ul>
9191
</td>
92-
{% elif key == 'providers' %}
92+
{% elif key == 'contacts' %}
9393
<td>
94-
{% for cnt in data['properties']['providers'] %}
95-
{% if 'name' in cnt and cnt['name'] not in [None,''] %}
96-
{{ cnt['name'] }} <br/>
97-
{% endif %}
98-
{% if 'roles' in cnt and cnt['roles'] is not string %}
99-
Role: {{ cnt['roles'] | map(attribute='name') | join(',') }} <br/>
100-
{% endif %}
101-
{% if 'positionName' in cnt and cnt['positionName'] not in [None,''] %}
102-
Position: {{ cnt['positionName'] }})<br/>
103-
{% endif %}
104-
{% if 'contactInfo' in cnt and cnt['contactInfo'] is not string %}
105-
{% for k,e in cnt['contactInfo'].get('phone',{}).items() %}
106-
{% if e %}{{ k }}: {{ e }}<br/>{% endif %}
107-
{% endfor %}
108-
{% for k,e in cnt['contactInfo'].get('email',{}).items() %}
109-
{% if e not in [None,''] %}{{ k }}: {{ e | urlize }}<br/>{% endif %}
110-
{% endfor %}
111-
{% for k,e in cnt['contactInfo'].get('address',{}).items() %}
112-
{{ k }}: {% for a,b in e.items() %}{% if b %}{{ b }}, {% endif %}{% endfor %}<br/>
113-
{% endfor %}
114-
{% if cnt['contactInfo']['url'] %}
115-
{{ cnt['contactInfo']['url'].get('href','') | urlize }}
94+
{% for cnt in data['properties']['contacts'] %}
95+
<table>
96+
{% if cnt.name %}
97+
<tr>
98+
<td>Name: {{ cnt.name }}</td>
99+
</tr>
100+
{% endif %}
101+
<tr>
102+
<td>Roles: {{ cnt.roles | join(',') }} </td>
103+
</tr>
104+
{% if cnt.position %}
105+
<tr>
106+
<td>Position: {{ cnt['position'] }}</td>
107+
</tr>
116108
{% endif %}
117-
{% endif %}
109+
<tr>
110+
<td>Addresses</td>
111+
</tr>
112+
{% for address in cnt.addresses %}
113+
<tr>
114+
<td>
115+
<table>
116+
<tr>
117+
<td>
118+
Address: {{ address['deliveryPoint'] | join(',') }}<br/>
119+
City: {{ address['city'] }}<br/>
120+
Administrative area: {{ address['administrativeArea'] }}<br/>
121+
Postal code: {{ address['postalCode'] }}<br/>
122+
Country: {{ address['country'] }}<br/>
123+
</td>
124+
</tr>
125+
</table>
126+
</td>
127+
</tr>
128+
{% endfor %}
129+
<tr>
130+
<td>Phone: {{ cnt.phones | map(attribute='value') | join(', ') }}</td>
131+
</tr>
132+
<tr>
133+
<td>Email: {{ cnt.emails | map(attribute='value') | join(', ') }}</td>
134+
</tr>
135+
<tr>
136+
<td>
137+
Links:
138+
<ul>
139+
{% for link in cnt.links %}
140+
<li>{{ link.href | urlize }}</li>
141+
{% endfor %}
142+
</ul>
143+
</td>
144+
</tr>
145+
</table>
118146
{% endfor %}
119147
</td>
120148
{% else %}
@@ -131,15 +159,19 @@ <h2>{{ data.get('properties',{}).get('title',data['id']) }}</h2>
131159
<tr>
132160
<td>Temporal</td>
133161
<td>
162+
{% if data['time'].get('date') %}
163+
{{ data['time']['date'] }}
164+
{% elif data['time'].get('timestamp') %}
165+
{{ data['time']['timestamp'] }}
166+
{% elif data['time'].get('interval') %}
134167
<ul>
135-
{% if data['time'] is string %}
136-
<li>{{ data['time'] }}</li>
137-
{% else %}
138-
{% for d in data['time'] %}
139-
<li>{{ d }}</li>
140-
{% endfor %}
141-
{% endif %}
168+
<li>begin: {{ data['time']['interval'][0] }}</li>
169+
<li>end: {{ data['time']['interval'][1] }}</li>
142170
</ul>
171+
{% endif %}
172+
{% if data['time'].get('resolution') %}
173+
Resolution: {{ data['time']['resolution'] }}
174+
{% endif %}
143175
</td>
144176
</tr>
145177
{% endif %}

0 commit comments

Comments
 (0)