summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-05-24 18:38:08 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-05-24 18:38:08 +0200
commit7789f8202f60f69ce015b1bc34eb0c076d7545b5 (patch)
treef03e4bd8d481f57e85b7444e3bd6ec8114c9ba89 /templates
parentc1812cecea4d311c89dd46cf80985bbdfa6c778c (diff)
animate train position in map3.2.0
Diffstat (limited to 'templates')
-rw-r--r--templates/_error.html.ep5
-rw-r--r--templates/_map_infobox.html.ep61
-rw-r--r--templates/layouts/app.html.ep1
-rw-r--r--templates/route_map.html.ep59
4 files changed, 69 insertions, 57 deletions
diff --git a/templates/_error.html.ep b/templates/_error.html.ep
new file mode 100644
index 0000000..4abfb4e
--- /dev/null
+++ b/templates/_error.html.ep
@@ -0,0 +1,5 @@
+<div class="error"><strong>Fehler:</strong>
+<pre>
+%= $error
+</pre>
+</div>
diff --git a/templates/_map_infobox.html.ep b/templates/_map_infobox.html.ep
new file mode 100644
index 0000000..8f66a6f
--- /dev/null
+++ b/templates/_map_infobox.html.ep
@@ -0,0 +1,61 @@
+<div class="container" id="infobox" style="margin-top: 1ex; margin-bottom: 1ex;">
+<div class="journey" id="jdata"
+data-req="<%= stash('ajax_req') %>"
+data-route="<%= stash('ajax_route') %>"
+data-poly="<%= stash('ajax_polyline') %>"
+>
+ Fahrt
+ % if (stash('train_no')) {
+ <strong><%= stash('train_no') %></strong>
+ % }
+ von <strong><%= stash('origin')->{name} %></strong>
+ nach <strong><%= stash('destination')->{name} %></strong>
+</div>
+% if (my $next = stash('next_stop')) {
+ <div class="nextstop">
+ % if ($next->{type} eq 'present' and $next->{station}{dep} and $next->{station}{arr}) {
+ Aufenthalt in <strong><%= $next->{station}{name} %></strong>
+ an Gleis <strong><%= $next->{station}{platform} %></strong>
+ bis <strong><%= $next->{station}{dep}->strftime('%H:%M') %></strong>
+ % if ($next->{station}{dep_delay}) {
+ %= sprintf('(%+d)', $next->{station}{dep_delay})
+ % }
+ % }
+ % elsif ($next->{type} eq 'present' and $next->{station}{dep}) {
+ Abfahrt in <strong><%= $next->{station}{name} %></strong>
+ von Gleis <strong><%= $next->{station}{platform} %></strong>
+ um <strong><%= $next->{station}{dep}->strftime('%H:%M') %></strong>
+ % if ($next->{station}{dep_delay}) {
+ %= sprintf('(%+d)', $next->{station}{dep_delay})
+ % }
+ % }
+ % elsif ($next->{type} eq 'present' and $next->{station}{arr}) {
+ Endstation erreicht um
+ <strong><%= $next->{station}{arr}->strftime('%H:%M') %></strong>
+ auf Gleis <strong><%= $next->{station}{platform} %></strong>
+ % if ($next->{station}{arr_delay}) {
+ %= sprintf('(%+d)', $next->{station}{arr_delay})
+ % }
+ % }
+ % elsif ($next->{type} eq 'present') {
+ Zug steht in
+ <strong><%= $next->{station}{arr}->strftime('%H:%M') %></strong>
+ auf Gleis <strong><%= $next->{station}{platform} %></strong>
+ % }
+ % elsif ($next->{type} eq 'next' and $next->{station}{arr}) {
+ Nächster Halt:
+ <strong><%= $next->{station}{name} %></strong>
+ um <strong><%= $next->{station}{arr}->strftime('%H:%M') %></strong>
+ % if ($next->{station}{arr_delay}) {
+ %= sprintf('(%+d)', $next->{station}{arr_delay})
+ % }
+ auf Gleis <strong><%= $next->{station}{platform} %></strong>
+ % }
+ % elsif ($next->{type} eq 'next') {
+ Nächster Halt:
+ <strong><%= $next->{station}{name} %></strong>
+ auf Gleis <strong><%= $next->{station}{platform} %></strong>
+ % }
+ </div>
+% }
+</div>
diff --git a/templates/layouts/app.html.ep b/templates/layouts/app.html.ep
index d7320de..fc81ba3 100644
--- a/templates/layouts/app.html.ep
+++ b/templates/layouts/app.html.ep
@@ -61,6 +61,7 @@
% if (stash('with_map')) {
%= stylesheet "/static/${av}/leaflet/leaflet.css"
%= javascript "/static/${av}/leaflet/leaflet.js"
+ %= javascript "/static/${av}/js/map-refresh.min.js", defer => undef
% }
</head>
<body>
diff --git a/templates/route_map.html.ep b/templates/route_map.html.ep
index 6ed1b57..6f5643b 100644
--- a/templates/route_map.html.ep
+++ b/templates/route_map.html.ep
@@ -1,58 +1,5 @@
% if ($origin and $destination) {
- <div class="container" style="margin-top: 1ex; margin-bottom: 1ex;">
- Fahrt
- % if (stash('train_no')) {
- <strong><%= stash('train_no') %></strong>
- % }
- von <strong><%= $origin->{name} %></strong>
- nach <strong><%= $destination->{name} %></strong>
- % if (my $next = stash('next_stop')) {
- <br/>
- % if ($next->{type} eq 'present' and $next->{station}{dep} and $next->{station}{arr}) {
- Aufenthalt in <strong><%= $next->{station}{name} %></strong>
- an Gleis <strong><%= $next->{station}{platform} %></strong>
- bis <strong><%= $next->{station}{dep}->strftime('%H:%M') %></strong>
- % if ($next->{station}{dep_delay}) {
- %= sprintf('(%+d)', $next->{station}{dep_delay})
- % }
- % }
- % elsif ($next->{type} eq 'present' and $next->{station}{dep}) {
- Abfahrt in <strong><%= $next->{station}{name} %></strong>
- von Gleis <strong><%= $next->{station}{platform} %></strong>
- um <strong><%= $next->{station}{dep}->strftime('%H:%M') %></strong>
- % if ($next->{station}{dep_delay}) {
- %= sprintf('(%+d)', $next->{station}{dep_delay})
- % }
- % }
- % elsif ($next->{type} eq 'present' and $next->{station}{arr}) {
- Endstation erreicht um
- <strong><%= $next->{station}{arr}->strftime('%H:%M') %></strong>
- auf Gleis <strong><%= $next->{station}{platform} %></strong>
- % if ($next->{station}{arr_delay}) {
- %= sprintf('(%+d)', $next->{station}{arr_delay})
- % }
- % }
- % elsif ($next->{type} eq 'present') {
- Zug steht in
- <strong><%= $next->{station}{arr}->strftime('%H:%M') %></strong>
- auf Gleis <strong><%= $next->{station}{platform} %></strong>
- % }
- % elsif ($next->{type} eq 'next' and $next->{station}{arr}) {
- Nächster Halt:
- <strong><%= $next->{station}{name} %></strong>
- um <strong><%= $next->{station}{arr}->strftime('%H:%M') %></strong>
- % if ($next->{station}{arr_delay}) {
- %= sprintf('(%+d)', $next->{station}{arr_delay})
- % }
- auf Gleis <strong><%= $next->{station}{platform} %></strong>
- % }
- % elsif ($next->{type} eq 'next') {
- Nächster Halt:
- <strong><%= $next->{station}{name} %></strong>
- auf Gleis <strong><%= $next->{station}{platform} %></strong>
- % }
- % }
- </div>
+ %= include '_map_infobox'
% }
<div class="container">
@@ -135,9 +82,7 @@ var marker;
Die eingezeichnete Route stammt aus dem HAFAS und ist im Detail oft
fehlerbehaftet.<br/>
Die Zugposition auf der Karte ist eine DBF-eigene Schätzung und kann erheblich
-von der tatsächlichen Position des Zugs abweichen.<br/>
-Live-Tracking mit automatischer Kartenaktualisierung wird noch nicht
-unterstützt.
+von den tatsächlichen Gegebenheiten abweichen.
</div>
% if (my $op = stash('operator')) {