diff options
-rw-r--r-- | index.pl | 46 | ||||
-rw-r--r-- | public/default.css | 13 | ||||
-rw-r--r-- | templates/clean.html.ep | 47 |
3 files changed, 88 insertions, 18 deletions
@@ -250,13 +250,12 @@ sub handle_request { $result->delay, $delaymsg ? q{: } : q{}, $delaymsg ); } } - if ( $result->replacement_for and $template ne 'clean') { - for my $rep ($result->replacement_for) { - $info = sprintf('Ersatzzug für %s %s %s%s', - $rep->type, - $rep->train_no, - $info ? '+++ ' : q{}, - $info // q{} + if ( $result->replacement_for and $template ne 'clean' ) { + for my $rep ( $result->replacement_for ) { + $info = sprintf( + 'Ersatzzug für %s %s %s%s', + $rep->type, $rep->train_no, + $info ? '+++ ' : q{}, $info // q{} ); } } @@ -426,11 +425,28 @@ sub handle_request { push( @departures, { - time => $time, + time => $time, + sched_arrival => $result->sched_arrival + ? $result->sched_arrival->strftime('%H:%M') + : undef, + sched_departure => $result->sched_departure + ? $result->sched_departure->strftime('%H:%M') + : undef, + arrival => $result->arrival + ? $result->arrival->strftime('%H:%M') + : undef, + departure => $result->departure + ? $result->departure->strftime('%H:%M') + : undef, train => $result->train, + train_type => $result->type, + train_line => $result->line_no, + train_no => $result->train_no, via => [ $result->route_interesting(3) ], scheduled_route => [ $result->sched_route ], + route_post => [ $result->route_post ], destination => $result->destination, + origin => $result->origin, platform => $platform, info => $info, is_cancelled => $result->can('is_cancelled') @@ -451,9 +467,17 @@ sub handle_request { additional_stops => [ $result->additional_stops ], canceled_stops => [ $result->canceled_stops ], replaced_by => $result->can('replaced_by') - ? [ map { $_->type . q{ } . $_->train_no } $result->replaced_by ] : [], - replacement_for => $result->can('replacement_for') - ? [ map { $_->type . q{ } . $_->train_no } $result->replacement_for ] : [], + ? [ + map { $_->type . q{ } . $_->train_no } + $result->replaced_by + ] + : [], + replacement_for => $result->can('replacement_for') + ? [ + map { $_->type . q{ } . $_->train_no } + $result->replacement_for + ] + : [], } ); } diff --git a/public/default.css b/public/default.css index e4d36a5..42f8f94 100644 --- a/public/default.css +++ b/public/default.css @@ -109,12 +109,14 @@ div.displayclean li .moreinfo { position:fixed; top:1em; left:1em; + right:1em; min-height: 1em; - width: 90%; + max-height: 90%; background-color: white; border: 1px solid black; z-index: 5; display: none; + overflow: auto; } div.displayclean li .collapsed-moreinfo { @@ -125,7 +127,14 @@ div.displayclean li .expanded-moreinfo { display: block; } -div.displayclean li .moreinfo .reason { +div.displayclean li .moreinfo .mheader { + text-align: center; + background-color: #cccccc; + font-size: 120%; +} + +div.displayclean li .moreinfo .reason, +div.displayclean li .moreinfo .minfo { color: #ff0000; } diff --git a/templates/clean.html.ep b/templates/clean.html.ep index 3e4ad86..bc9579c 100644 --- a/templates/clean.html.ep +++ b/templates/clean.html.ep @@ -35,12 +35,49 @@ % } </span> % } -% if ($departure->{moreinfo} and @{$departure->{moreinfo}}) { <span class="moreinfo"> -<ul> -% if ($route_str) { -<li> Via: <%= $route_str %> </li> +<div class="mheader"> +<span class="train-line"><%= $departure->{train_type} // q{???} %></span><!-- +--><span class="train-line"><%= $departure->{train_line} // q{} %></span> +% if ($departure->{train_line}) { +<span class="train-no"><%= $departure->{train_no} // q{???} %></span> +% } +% else { +<span class="train-line"><%= $departure->{train_no} // q{???} %></span> +% } +: +<span class="train-origin"><%= $departure->{origin} // q{???} %></span> +→ +<span class="train-dest"><%= $departure->{destination} // q{???} %></span> +% if ($departure->{is_cancelled}) { +<div class="minfo">Fahrt fällt aus</div> +% } +% elsif ($departure->{delay} > 0) { +<div class="minfo">+<%= $departure->{delay} %></div> +% } +</div> +% if (not $departure->{is_cancelled}) { +% if ($departure->{sched_arrival}) { +Ankunft: <%= $departure->{sched_arrival} %> +% if ($departure->{arrival} and $departure->{arrival} ne $departure->{sched_arrival}) { +(heute: <%= $departure->{arrival} %>) % } +<br/> +% } +% if ($departure->{sched_departure}) { +Abfahrt: <%= $departure->{sched_departure} %> +% if ($departure->{departure} and $departure->{departure} ne $departure->{sched_departure}) { +(heute: <%= $departure->{departure} %>) +% } +<br/> +% } +% } +% if ($departure->{route_post} and @{$departure->{route_post}}) { +Über: <span class="mroute"><%= join(' – ', @{$departure->{route_post} // q{???}}) %></span><br/> +% } +% if ($departure->{moreinfo} and @{$departure->{moreinfo}}) { +Meldungen: +<ul> % for my $pair (@{$departure->{moreinfo}}) { <li> % if ($pair->[0]->isa('DateTime')) { @@ -56,8 +93,8 @@ </li> % } </ul> -</span> % } +</span> % if ($departure->{info} and length $departure->{info}) { <span class="info"> %= $departure->{info} |