summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-07-11 11:45:54 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-07-11 11:45:54 +0200
commitc8e524c6d31ab8ae8eb12dc595f3ecca20445920 (patch)
tree707b1df335d0938ed610b07c40e4e375c5e8275a
parentee44b8a5fce952d4173c47f0d862a4d2d4567578 (diff)
map link: highlight requested stop
-rwxr-xr-xbin/nvm2
-rw-r--r--templates/departure_list.html2
2 files changed, 3 insertions, 1 deletions
diff --git a/bin/nvm b/bin/nvm
index e6c973a..6bb82b3 100755
--- a/bin/nvm
+++ b/bin/nvm
@@ -154,6 +154,8 @@ class Departure:
self.stop_name = obj.get("stop", dict()).get("name", None)
self.station_name = obj.get("station", dict()).get("name", self.stop_name)
+ self.quoted_stop_name = aiohttp.helpers.quote(self.stop_name)
+
try:
self.location = (
obj["stop"]["location"]["longitude"],
diff --git a/templates/departure_list.html b/templates/departure_list.html
index dea886c..de7b48d 100644
--- a/templates/departure_list.html
+++ b/templates/departure_list.html
@@ -15,7 +15,7 @@
{% endif %}
<ul class="departures">
{% for departure in departures %}
- <li class="{{ departure.classes }}" onclick="location.href='https://dbf.finalrewind.org/map/{{ departure.tripId }}/0';">
+ <li class="{{ departure.classes }}" onclick="location.href='https://dbf.finalrewind.org/map/{{ departure.tripId }}/0?from={{ departure.quoted_stop_name }}';">
<span class="line {{ departure.line.css_class }}">{{ departure.line.name }}</span>
{% if departure.suffix %}
<span class="destsuffix">{{ departure.suffix }}</span>