summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-01-06 07:56:08 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-01-06 07:56:08 +0100
commit6d8511731a1b6d84d2a6b013e27569af03160550 (patch)
treebbf05e2ff8d6c737f8b89825d4e7e3d6aa584cdd
parent503bdc30e4e2fe5dce9ba5c4b24250e31931d8b0 (diff)
train details: add date switcher
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm2
-rw-r--r--lib/DBInfoscreen/I18N/en.pm2
-rw-r--r--templates/_train_details.html.ep5
3 files changed, 7 insertions, 2 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index 667bafe..e563b80 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -817,6 +817,7 @@ sub render_train {
$departure->{trip_id} = $journey->id;
$departure->{operator} = $journey->operator;
+ $departure->{date} = $route->[0]{sched_dep} // $route->[0]{dep};
# Use HAFAS route as source of truth; ignore IRIS data
$departure->{route_pre_diff} = [];
@@ -1132,6 +1133,7 @@ sub train_details {
my ( $route, $journey ) = @_;
$res->{trip_id} = $journey->id;
+ $res->{date} = $route->[0]{sched_dep} // $route->[0]{dep};
if ( not $res->{train_type} ) {
my $train_type = $res->{train_type} = $journey->type // q{};
diff --git a/lib/DBInfoscreen/I18N/en.pm b/lib/DBInfoscreen/I18N/en.pm
index 5942f30..3abb70f 100644
--- a/lib/DBInfoscreen/I18N/en.pm
+++ b/lib/DBInfoscreen/I18N/en.pm
@@ -56,7 +56,7 @@ our %Lexicon = (
'Hohe Auslastung erwartet' => 'High occupancy expected',
'Sehr hohe Auslastung erwartet' => 'Very high occupancy expected',
'Meldungen' => 'Messages',
- 'Fahrtverlauf' => 'Route',
+ 'Fahrtverlauf am' => 'Route on',
'Betrieb' => 'Operator',
'Karte' => 'Map',
'Wagen' => 'Composition',
diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep
index 849af3b..3e60612 100644
--- a/templates/_train_details.html.ep
+++ b/templates/_train_details.html.ep
@@ -203,7 +203,10 @@
</ul>
% }
% if ($departure->{route_pre_diff} and $departure->{route_post_diff}) {
-%= l 'Fahrtverlauf'
+%= l 'Fahrtverlauf am'
+ <a href="<%= url_for('train', train => stash('train'))->query({detailed => param('detailed'), past => param('past'), rt => param('rt'), hafas => param('hafas'), date => $departure->{date}->clone->subtract(days => 1)->strftime('%d.%m.%Y'), highlight => param('highlight') // stash('station')}) %>">◀</a>
+%= $departure->{date}->strftime('%d.%m.%Y')
+ <a href="<%= url_for('train', train => stash('train'))->query({detailed => param('detailed'), past => param('past'), rt => param('rt'), hafas => param('hafas'), date => $departure->{date}->clone->add(days => 1)->strftime('%d.%m.%Y'), highlight => param('highlight') // stash('station')}) %>">▶</a>
<ul class="mroute">
% for my $stop (@{$departure->{route_pre_diff}}) {
<li class="<%= $stop->{isPast} ? 'past-stop' : 'future-stop' %>">