diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2020-01-07 18:28:53 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-01-07 18:28:53 +0100 |
commit | cd4e1246ca33b7f0056be36a640bc2a7340a6667 (patch) | |
tree | 827bd80c38fa84974413a1c7100e79673f4b2bdd | |
parent | 27bb2b67af84529cd5ee7a61e77008614d868c34 (diff) |
show planned IC/ICE type in detail view
-rw-r--r-- | lib/DBInfoscreen.pm | 4 | ||||
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 3 | ||||
-rw-r--r-- | templates/_train_details.html.ep | 9 | ||||
-rw-r--r-- | templates/app.html.ep | 4 |
4 files changed, 13 insertions, 7 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index d8f5b87..9285a82 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -68,8 +68,8 @@ sub startup { scalar read_file('share/ice_type.json') ); my $ret; while ( my ( $k, $v ) = each %{$ice_type_map} ) { - if ( $v->{short} ) { - $ret->{$k} = $v->{short}; + if ( $v->{type} ) { + $ret->{$k} = [ $v->{type}, $v->{short} ]; } } return $ret; diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 60caf8d..9f0bd31 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1258,7 +1258,8 @@ sub handle_request { '_train_details', departure => $departure, linetype => $linetype, - dt_now => DateTime->now( time_zone => 'Europe/Berlin' ), + icetype => $self->app->ice_type_map->{ $departure->{train_no} }, + dt_now => DateTime->now( time_zone => 'Europe/Berlin' ), ); } else { diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep index 444fe9a..0ace74c 100644 --- a/templates/_train_details.html.ep +++ b/templates/_train_details.html.ep @@ -73,9 +73,14 @@ % } % } </div> <!-- timeinfo --> -% if ($departure->{wr_link}) { +% if ($departure->{wr_link} or ($icetype and $icetype->[1])) { <div class="verbose"> - <a href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>">Wagenreihung</a> +% if ($departure->{wr_link}) { + <a href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>">Wagenreihung</a> +% } +% if ($icetype and $icetype->[1]) { + (Plan: <%= $icetype->[0] %>)<br/> +% } </div> % } % if ($departure->{trip_id}) { diff --git a/templates/app.html.ep b/templates/app.html.ep index d6d07b6..fd7c1f1 100644 --- a/templates/app.html.ep +++ b/templates/app.html.ep @@ -83,8 +83,8 @@ %= $departure->{train_line} % } % elsif ($departure->{train_no}) { -% if (exists $ice_type->{$departure->{train_no}}) { - <span class="trainsubtype"><%= $ice_type->{$departure->{train_no}} %></span> +% if (exists $ice_type->{$departure->{train_no}} and $ice_type->{$departure->{train_no}}[1]) { + <span class="trainsubtype"><%= $ice_type->{$departure->{train_no}}[1] %></span> % } <span class="trainno"><%= $departure->{train_no} %></span> % } |