summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm24
-rw-r--r--templates/_train_details.html.ep25
2 files changed, 46 insertions, 3 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index 735cbe7..c2a5f80 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -676,7 +676,8 @@ sub render_train {
sub {
my ( $route_ts, $journey ) = @_;
- $departure->{trip_id} = $journey->id;
+ $departure->{trip_id} = $journey->id;
+ $departure->{operator} = $journey->operator;
if ( my $load = $route_ts->{$station_name}{load} ) {
if ( %{$load} ) {
@@ -755,8 +756,14 @@ sub render_train {
}
my @him_messages;
+ my @him_details;
for my $message ( $journey->messages ) {
- if ( not $message->code ) {
+ if ( $message->code ) {
+ push( @him_details,
+ [ $message->short // q{}, { text => $message->text } ]
+ );
+ }
+ else {
push( @him_messages,
[ $message->short // q{}, { text => $message->text } ]
);
@@ -775,6 +782,7 @@ sub render_train {
$m->[0] =~ s{(?!<)->}{ → };
}
unshift( @{ $departure->{moreinfo} }, @him_messages );
+ unshift( @{ $departure->{details} }, @him_details );
}
)->catch(
sub {
@@ -1010,6 +1018,7 @@ sub train_details {
$res->{origin} = $journey->route_start;
$res->{destination} = $journey->route_end;
+ $res->{operator} = $journey->operator;
$res->{route_post_diff}
= [ map { { name => $_->{name} } } $journey->route ];
@@ -1020,8 +1029,14 @@ sub train_details {
}
my @him_messages;
+ my @him_details;
for my $message ( $journey->messages ) {
- if ( not $message->code ) {
+ if ( $message->code ) {
+ push( @him_details,
+ [ $message->short // q{}, { text => $message->text } ]
+ );
+ }
+ else {
push( @him_messages,
[ $message->short // q{}, { text => $message->text } ]
);
@@ -1041,6 +1056,9 @@ sub train_details {
if (@him_messages) {
$res->{moreinfo} = [@him_messages];
}
+ if (@him_details) {
+ $res->{details} = [@him_details];
+ }
$self->render(
$self->param('ajax') ? '_train_details' : 'train_details',
diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep
index 9a440ef..2d61939 100644
--- a/templates/_train_details.html.ep
+++ b/templates/_train_details.html.ep
@@ -288,6 +288,31 @@
% }
</ul> <!-- mroute -->
% }
+% if ($departure->{operator}) {
+ <div>Betrieb: <%= $departure->{operator} %></div>
+% }
+% if ($departure->{details} and @{$departure->{details}}) {
+ Details:
+ <ul class="messages">
+% for my $pair (@{$departure->{details}}) {
+ <li>
+% if ($pair->[1]{icon}) {
+ <i class="material-icons"><%= $pair->[1]{icon} %></i>
+% }
+%= $pair->[0]
+% if (length($pair->[0]) > 25) {
+ <br/>
+% }
+ <span class="reason">
+%= $pair->[1]{text}
+ </span>
+ </li>
+% }
+% if ($departure->{route_info}) {
+ <li><%= $departure->{route_info} %></li>
+% }
+ </ul>
+% }
% if ($departure->{has_cycle}) {
<div class="db-attr"><a href="https://lib.finalrewind.org/dbdb/db_umlauf/<%= $departure->{train_no} %>.svg">Umlaufplan</a>
(ggf. fehlerhaft)</div>