From d9d3aac79200ca7d896d753c897e1651517ecf36 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 19 May 2019 10:32:57 +0200 Subject: allow checkin from connections view --- templates/_checked_in.html.ep | 30 +------------------- templates/_checked_out.html.ep | 5 ++++ templates/_connections.html.ep | 60 +++++++++++++++++++++++++++++++++++++++ templates/layouts/default.html.ep | 2 +- 4 files changed, 67 insertions(+), 30 deletions(-) create mode 100644 templates/_connections.html.ep (limited to 'templates') diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep index 39bc1e3..d5b14e5 100644 --- a/templates/_checked_in.html.ep +++ b/templates/_checked_in.html.ep @@ -79,35 +79,7 @@ % } % if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} < (20*60)) { % if (my @connections = get_connecting_trains()) { - Verbindungen -
- % for my $res (@connections) { - % my ($train, $via) = @{$res}; - - - - - - % } -
<%= $train->line %><%= $via %><%= $train->departure->strftime('%H:%M') %> - % if ($train->departure_delay) { - %= sprintf('(%+d)', $train->departure_delay) - % } -
Gleis <%= $train->platform %>
-
- % for my $res (@connections) { - % my ($train, $via) = @{$res}; - - - - - - % } -
<%= $train->line %><%= $via %><%= $train->departure->strftime('%H:%M') %> - % if ($train->departure_delay) { - %= sprintf('(%+d)', $train->departure_delay) - % } - Gleis <%= $train->platform %>
+ %= include '_connections', connections => \@connections, checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_ds100} : undef; % } % } % if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) { diff --git a/templates/_checked_out.html.ep b/templates/_checked_out.html.ep index 9c7ff48..18b613b 100644 --- a/templates/_checked_out.html.ep +++ b/templates/_checked_out.html.ep @@ -3,6 +3,11 @@ Ausgecheckt

Aus <%= $journey->{train_type} %> <%= $journey->{train_no} %> bis <%= $journey->{arr_name} %>

+ % if (now()->epoch - $journey->{timestamp}->epoch < (30*60)) { + % if (my @connections = get_connecting_trains()) { + %= include '_connections', connections => \@connections, checkin_from => $journey->{arr_ds100}; + % } + % }
diff --git a/templates/_connections.html.ep b/templates/_connections.html.ep new file mode 100644 index 0000000..1c7f003 --- /dev/null +++ b/templates/_connections.html.ep @@ -0,0 +1,60 @@ +Verbindungen +% if ($checkin_from) { +

Zug auswählen zum Einchecken mit Zielwahl.

+% } +
+ % for my $res (@{$connections}) { + % my ($train, $via) = @{$res}; + + + + + + % } +
+ % if ($checkin_from) { + <%= $train->line %> + % } + % else { + %= $train->line + % } + + % if ($checkin_from) { + <%= $via %> + % } + % else { + %= $via + % } + <%= $train->departure->strftime('%H:%M') %> + % if ($train->departure_delay) { + %= sprintf('(%+d)', $train->departure_delay) + % } +
Gleis <%= $train->platform %>
+
+ % for my $res (@{$connections}) { + % my ($train, $via) = @{$res}; + + + + + + % } +
+ % if ($checkin_from) { + <%= $train->line %> + % } + % else { + %= $train->line + % } + + % if ($checkin_from) { + <%= $via %> + % } + % else { + %= $via + % } + <%= $train->departure->strftime('%H:%M') %> + % if ($train->departure_delay) { + %= sprintf('(%+d)', $train->departure_delay) + % } + Gleis <%= $train->platform %>
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index 4c94c50..ab2ce82 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -9,7 +9,7 @@ - % my $av = 'v23'; # asset version + % my $av = 'v24'; # asset version -- cgit v1.2.3