MapCampaigner
MapCampaigner copied to clipboard
Update rendered HTML to JSON endpoints
contents.html, map.html and errors.html are currently rendered and stored on s3 then fetched during templating. This has cause some issue while making improvements so let's seek to render these client side with JS where it makes sense with JSON data endpoints.
marking this as discussion because some thoguht should go into what should be server rendered and what is better sent as JSON then client rendered
OK, I had a look on S3 and I think I get it.
The frontend would have templates for content.html
, map.html
, errors.html
which would get data passed in from the backend for a specific campaign the user is trying to view by
- either reaching the routes
/campaigns/<campaing-uuid>/feature_completeness.json
,/campaigns/<campaing-uuid>/geojson_x.json
,/campaigns/<campaing-uuid>/errors_x.json
,/campaigns/<campaing-uuid>/count_feature.json
, - or reaching one route like
/campaigns/<campaing-uuid>/render_campaign.json
. Whererender_campaign.json
would contain data from the S3 filesfeature_completeness.json
,geojson_x.json
,errors_x.json
,count_feature.json
.
It looks like any of those would mean modifying the lambda function [prod/staging]_render_feature
on the backend at least.
OK, views.py
also need modifying and the campaign_detail.html
would import a JS script where the Ajax calls would be made.
@Eleonore9 Jorge has updated map.html for his work in creating gpx, its now a flask template in his feature branch