Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add park and ride spaces information to the entity detail screen

  • Loading branch information...
commit a4d6de1fc5fa729fe33f2647e6a8c022fabd2545 1 parent fceb7d3
@cnorthwood cnorthwood authored
View
1  demos/molly_oxford/providers/apps/places/__init__.py
@@ -44,6 +44,7 @@ def augment_metadata(self, entities):
carparks[self._CARPARKS[name]].metadata['park_and_ride'] = {
'spaces': int(tr[2].text),
'capacity': int(tr[3].text),
+ 'percentage': int(100 * (1 - float(tr[2].text) / float(tr[3].text))),
}
except Exception, e:
logger.exception("The Park and Ride page has changed in some way")
View
1  molly/apps/places/templates/places/entity_detail.html
@@ -35,5 +35,6 @@
{% include "places/metadata/oxpoints.html" %}
{% include "places/metadata/osm.html" %}
+{% include "places/metadata/park_and_ride.html" %}
{% endblock %}
View
13 molly/apps/places/templates/places/metadata/park_and_ride.html
@@ -0,0 +1,13 @@
+{% if entity.metadata.park_and_ride %}
+<div class="section">
+ <h2>Car Park Information</h2>
+ <div class="article">
+ <div class="bubble pad-5">
+ Spaces: {{ entity.metadata.park_and_ride.spaces }} / {{ entity.metadata.park_and_ride.capacity }}
+ <div style="width:100%;border: 1px solid #7c7c7c;height: 5px; background-color:#00ff00;">
+ <div style="width: {{ entity.metadata.park_and_ride.percentage }}%; height:5px;background-color: #ff0000;">&nbsp;</div>
+ </div>
+ </div>
+ </div>
+</div>
+{% endif %}
View
10 molly/apps/transport/templates/transport/index.html
@@ -2,10 +2,6 @@
{% block content %}
-{% if train_station %}
-{% include "places/metadata/ldb.html" %}
-{% endif %}
-
<div class="section">
<div class="header">
<h2>Park and Rides</h2>
@@ -90,6 +86,10 @@
</table>
</div>
+{% if train_station %}
+{% include "places/metadata/ldb.html" %}
+{% endif %}
+
{% if travel_alerts %}
<div class="section">
@@ -99,7 +99,7 @@
<ul class="content-list">
{% for alert in travel_alerts %}
- <li>{{ alert.title }}</li>
+ <li><a href="{{ alert.get_absolute_url }}">{{ alert.title }}</a></li>
{% endfor %}
</ul>
</div>
View
1  molly/apps/transport/views.py
@@ -53,7 +53,6 @@ def initial_context(cls, request):
es = es.order_by('title')
entities |= set(es)
context['travel_alerts'] = es
-
# Get any real-time information for all the places we're about to display
places_conf = app_by_application_name('molly.apps.places')
Please sign in to comment.
Something went wrong with that request. Please try again.