Permalink
Browse files

Fix error in old outing versions without any geometry (#1492)

* Fix error in old outing versions without any geometry

* Fix - Do not add feature collection without geometry
  • Loading branch information...
1 parent a0d7a04 commit 383e28bae58d1d8009da5588d16915600b7868eb @dkocich dkocich committed on GitHub Feb 10, 2017
Showing with 32 additions and 20 deletions.
  1. +32 −20 c2corg_ui/templates/outing/view.html
@@ -36,27 +36,36 @@
<%block name="moduleConstantsValues">
<%
- geometry = outing['geometry']['geom_detail'] \
- if outing['geometry']['geom_detail'] else outing['geometry']['geom']
+ if outing.get('geometry'):
+ geometry = outing['geometry']['geom_detail'] \
+ if outing['geometry']['geom_detail'] else outing['geometry']['geom']
+ else:
+ geometry = None
%>
- module.value('mapFeatureCollection', {
- "type": "FeatureCollection",
- "properties": {},
- "features": [{
- "type": "Feature",
- "geometry": ${geometry | n},
- "properties": {
- "title": ${dumps(locale['title']) | n},
- "lang": "${locale['lang']}",
- "documentId": ${outing['document_id']},
- "module": "outings"
- }
- }
- % if not version:
- ${associated_images_featurelist(outing)}
+ module.value('mapFeatureCollection',
+ % if geometry:
+ {
+ "type": "FeatureCollection",
+ "properties": {},
+ "features": [
+ {
+ "type": "Feature",
+ "geometry": ${geometry | n},
+ "properties": {
+ "title": ${dumps(locale['title']) | n},
+ "lang": "${locale['lang']}",
+ "documentId": ${outing['document_id']},
+ "module": "outings"
+ }
+ }
+ % if not version:
+ ${associated_images_featurelist(outing)}
+ % endif
+ ]}
+ % else:
+ null
% endif
- ]
- });
+ );
module.value('documentData', {
"document_id": ${outing.get('document_id')},
@@ -84,7 +93,10 @@ <h1 class="routes">
${show_areas(outing)}
</article>
% endif
-<app-map class="view-details-map"></app-map>
+
+% if outing.get('geometry'):
+ <app-map class="view-details-map"></app-map>
+% endif
<section class="view-details-section" app-view-details>

0 comments on commit 383e28b

Please sign in to comment.