From d57aea18371f939c8e84ebf9af04a7dd9c6a8033 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 7 May 2015 19:08:16 +0200 Subject: more details in moreinfo popup --- index.pl | 46 +++++++++++++++++++++++++++++++++++----------- public/default.css | 13 +++++++++++-- templates/clean.html.ep | 47 ++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 88 insertions(+), 18 deletions(-) diff --git a/index.pl b/index.pl index 652ea60..3b698e8 100644 --- a/index.pl +++ b/index.pl @@ -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 @@ % } % } -% if ($departure->{moreinfo} and @{$departure->{moreinfo}}) { -