From 6c1cae86f4fa343b4f165f80a4e42eba37fa917c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 23 Apr 2019 22:27:13 +0200 Subject: Primitive auto-refresh of current journey status Todo: Redirect user to destination station upon arrival --- templates/_cancelled.html.ep | 27 ++++++++++++ templates/_checked_in.html.ep | 85 +++++++++++++++++++++++++++++++++++++ templates/_checked_out.html.ep | 12 ++++++ templates/departures.html.ep | 13 +----- templates/landingpage.html.ep | 88 +-------------------------------------- templates/layouts/default.html.ep | 2 +- 6 files changed, 128 insertions(+), 99 deletions(-) create mode 100644 templates/_cancelled.html.ep create mode 100644 templates/_checked_in.html.ep create mode 100644 templates/_checked_out.html.ep (limited to 'templates') diff --git a/templates/_cancelled.html.ep b/templates/_cancelled.html.ep new file mode 100644 index 0000000..d35c849 --- /dev/null +++ b/templates/_cancelled.html.ep @@ -0,0 +1,27 @@ +
+
+ Zugausfall dokumentieren +

Prinzipiell wärest du nun eingecheckt in + <%= $status->{train_type} %> <%= $status->{train_no} %> + ab <%= $status->{station_name} %>, doch dieser Zug fällt aus. +

+

Falls du den Zugausfall z.B. für ein Fahrgastrechteformular + dokumentieren möchtest, wähle bitte jetzt deine geplante + Zielstation aus. Achtung: Momentan wird dabei keine + Soll-Ankunftszeit gespeichert, das zu beheben steht auf + der Todoliste.

+ + + % my $is_after = 0; + % for my $station (@{$status->{route_after}}) { + + % } + +
<%= $station %>
+
+ +
diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep new file mode 100644 index 0000000..e4afeda --- /dev/null +++ b/templates/_checked_in.html.ep @@ -0,0 +1,85 @@ +
+
+ Eingecheckt +

+ In <%= $status->{train_type} %> <%= $status->{train_no} %> + % if ($status->{arr_name}) { + von <%= $status->{dep_name} %> nach <%= $status->{arr_name} %>. + % } + % else { + ab <%= $status->{dep_name} %>. + % } +

+

+ <%= $status->{real_departure}->strftime('%H:%M') %> + % if ($status->{real_departure}->epoch != $status->{sched_departure}->epoch) { + (<%= sprintf('%+d', ($status->{real_departure}->epoch - $status->{sched_departure}->epoch)/60) %>) + % } + → + % if ($status->{real_arrival}->epoch) { + <%= $status->{real_arrival}->strftime('%H:%M') %> + % if ($status->{real_arrival}->epoch != $status->{sched_arrival}->epoch) { + (<%= sprintf('%+d', ($status->{real_arrival}->epoch - $status->{sched_arrival}->epoch)/60) %>) + % } + % } + % else { + unbekannt + % } +

+

+

+ % if ($status->{departure_countdown} > 120) { + Abfahrt in <%= int($status->{departure_countdown} / 60) %> Minuten + % } + % elsif ($status->{arrival_countdown}) { + % if ($status->{arrival_countdown} > 0) { + Ankunft in <%= int($status->{arrival_countdown} / 60) %> + Minute<%= int($status->{arrival_countdown} / 60) == 1 ? '' : 'n' %> + % } + % else { + Ziel erreicht + % } + % } + % elsif ($status->{arr_name}) { + Ankunft in mehr als zwei Stunden + % } +
+
+
+
+

+ % if ($status->{arr_name}) { +

Zielstation ändern?

+ % } + % else { +

Zielstation wählen:

+ % } + + + % my $is_after = 0; + % for my $station (@{$status->{route_after}}) { + % if ($status->{arr_name} and $station eq $status->{arr_name}) { + + % } + % else { + + % } + % } + +
<%= $station %>
<%= $station %>
+ % if ($status->{arr_name}) { +

+ Falls das Backend ausgefallen ist oder der Zug aus anderen + Gründen verloren ging: Ohne Echtzeitdaten in <%= $status->{arr_name} %> + auschecken. +

+ % } +
+ +
diff --git a/templates/_checked_out.html.ep b/templates/_checked_out.html.ep new file mode 100644 index 0000000..cec61bc --- /dev/null +++ b/templates/_checked_out.html.ep @@ -0,0 +1,12 @@ +
+
+ Ausgecheckt +

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

+
+ +
diff --git a/templates/departures.html.ep b/templates/departures.html.ep index 7d33417..32a4336 100644 --- a/templates/departures.html.ep +++ b/templates/departures.html.ep @@ -16,18 +16,7 @@ % } % elsif ($status->{timestamp_delta} < 180) { -
-
- Ausgecheckt -

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

-
- -
+ %= include '_checked_out', status => $status; % } diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep index 84514c5..83b8303 100644 --- a/templates/landingpage.html.ep +++ b/templates/landingpage.html.ep @@ -12,94 +12,10 @@ % }
-
+
% my $status = get_user_status(); % if ($status->{checked_in}) { -
-
- Eingecheckt -

- In <%= $status->{train_type} %> <%= $status->{train_no} %> - % if ($status->{arr_name}) { - von <%= $status->{dep_name} %> nach <%= $status->{arr_name} %>. - % } - % else { - ab <%= $status->{dep_name} %>. - % } -

-

- <%= $status->{real_departure}->strftime('%H:%M') %> - % if ($status->{real_departure}->epoch != $status->{sched_departure}->epoch) { - (<%= sprintf('%+d', ($status->{real_departure}->epoch - $status->{sched_departure}->epoch)/60) %>) - % } - → - % if ($status->{real_arrival}->epoch) { - <%= $status->{real_arrival}->strftime('%H:%M') %> - % if ($status->{real_arrival}->epoch != $status->{sched_arrival}->epoch) { - (<%= sprintf('%+d', ($status->{real_arrival}->epoch - $status->{sched_arrival}->epoch)/60) %>) - % } - % } - % else { - unbekannt - % } -

-

-

- % if ($status->{departure_countdown} > 120) { - Abfahrt in <%= int($status->{departure_countdown} / 60) %> Minuten - % } - % elsif ($status->{arrival_countdown}) { - % if ($status->{arrival_countdown} > 0) { - Ankunft in <%= int($status->{arrival_countdown} / 60) %> - Minute<%= int($status->{arrival_countdown} / 60) == 1 ? '' : 'n' %> - % } - % else { - Ziel erreicht - % } - % } - % elsif ($status->{arr_name}) { - Ankunft in mehr als zwei Stunden - % } -
-
-
-
-

- % if ($status->{arr_name}) { -

Zielstation ändern?

- % } - % else { -

Zielstation wählen:

- % } - - - % my $is_after = 0; - % for my $station (@{$status->{route_after}}) { - % if ($status->{arr_name} and $station eq $status->{arr_name}) { - - % } - % else { - - % } - % } - -
<%= $station %>
<%= $station %>
- % if ($status->{arr_name}) { -

- Falls das Backend ausgefallen ist oder der Zug aus anderen - Gründen verloren ging: Ohne Echtzeitdaten in <%= $status->{arr_name} %> - auschecken. -

- % } -
- -
+ %= include '_checked_in', status => $status; % } % elsif ($status->{cancelled}) {
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index cdd624a..a2a5648 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -5,7 +5,7 @@ - % my $av = 'v6'; # asset version + % my $av = 'v7'; # asset version %= stylesheet "/static/${av}/css/materialize.min.css" %= stylesheet "/static/${av}/css/material-icons.css" %= stylesheet "/static/${av}/css/local.css" -- cgit v1.2.3