Permalink
Browse files

Add park and ride spaces information to the entity detail screen

  • Loading branch information...
1 parent fceb7d3 commit a4d6de1fc5fa729fe33f2647e6a8c022fabd2545 @cnorthwood cnorthwood committed Nov 22, 2010
@@ -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")
@@ -35,5 +35,6 @@
{% include "places/metadata/oxpoints.html" %}
{% include "places/metadata/osm.html" %}
+{% include "places/metadata/park_and_ride.html" %}
{% endblock %}
@@ -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 %}
@@ -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>
@@ -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')

0 comments on commit a4d6de1

Please sign in to comment.