From c66e4c7653f981c6aa3fee730d23be382ceedeea Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 23 Dec 2016 19:19:20 +0100 Subject: add time_format parameter --- templates/infoscreen.html.ep | 51 +++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/templates/infoscreen.html.ep b/templates/infoscreen.html.ep index 145c831..5c67ab0 100644 --- a/templates/infoscreen.html.ep +++ b/templates/infoscreen.html.ep @@ -31,6 +31,8 @@ % for my $departure (@{$raw}) { % my $linetype = q{}; % my $liclass = q{}; +% my $time_abs = q{}; +% my $time_rel = q{}; % if ($departure->can('type')) { % given ($departure->type) { % when ($_ =~ m{ (?: enbahn $ ) | Tram | STR }ix) { $linetype = 'tram' } @@ -39,8 +41,39 @@ % when ([qw[U-Bahn U]]) { $linetype = 'ubahn' } % } % } +% if ($departure->can('countdown')) { +% if ($departure->countdown > 1) { +% $time_rel = $departure->countdown -1 . ' min'; +% } +% else { +% $time_rel = 'sofort'; +% } +% } +% if ($departure->can('sched_time')) { +% $time_abs = $departure->sched_time; +% } +% else { +% $time_abs = $departure->time; +% } +% my $time_main = $time_rel; +% my $time_sec = $time_abs; +% if (my $timefmt = param('time_format')) { +% if ($timefmt eq 'abs_rel') { +% $time_main = $time_abs; +% $time_sec = $time_rel; +% } +% elsif ($timefmt eq 'abs') { +% $time_main = $time_abs; +% $time_sec = q{}; +% } +% elsif ($timefmt eq 'rel') { +% $time_main = $time_rel; +% $time_sec = q{}; +% } +% } % if ($departure->can('is_cancelled') and $departure->is_cancelled) { % $liclass = 'cancelled'; +% $time_main = q{}; % }
  • @@ -159,26 +192,14 @@ (+<%= $departure->delay %>) % } % if ($departure->can('is_cancelled') and $departure->is_cancelled) { - FÄLLT AUS + fällt aus % } % else { -% if ($departure->can('countdown')) { -% if ($departure->countdown > 1) { - <%= $departure->countdown - 1 %> min -% } -% else { - sofort -% } -% } +%= $time_main % } -% if ($departure->can('sched_time')) { -%= $departure->sched_time -% } -% else { -%= $departure->time -% } +%= $time_sec % if ($departure->can('platform') and $departure->platform) { %= $departure->platform -- cgit v1.2.3