summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-09-24 18:19:17 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-09-24 18:19:17 +0200
commitde074342de0bdc3604a0610a0c5f9cce5338bb85 (patch)
tree721c6c7415945ca57779e51db5dde00e136a62c2 /templates
parent8810acf742629294713448408ab6f0719f17952f (diff)
add support for HAFAS connection suggestions; drop manual destination list
Still TODO: handle stations that have several EVAs
Diffstat (limited to 'templates')
-rw-r--r--templates/_cancelled_departure.html.ep2
-rw-r--r--templates/_checked_in.html.ep14
-rw-r--r--templates/_checked_out.html.ep11
-rw-r--r--templates/_connections.html.ep6
-rw-r--r--templates/_connections_hafas.html.ep59
-rw-r--r--templates/_transit_fyi.html.ep22
-rw-r--r--templates/account.html.ep2
-rw-r--r--templates/departures.html.ep9
-rw-r--r--templates/use_history.html.ep24
9 files changed, 85 insertions, 64 deletions
diff --git a/templates/_cancelled_departure.html.ep b/templates/_cancelled_departure.html.ep
index 2f7f60b..79492a5 100644
--- a/templates/_cancelled_departure.html.ep
+++ b/templates/_cancelled_departure.html.ep
@@ -5,7 +5,7 @@
in <a href="/s/<%= $journey->{dep_eva} %>"><%= $journey->{dep_name} %></a>
entfällt. Der Zugausfall auf der Fahrt nach <%= $journey->{arr_name} %> wurde bereits dokumentiert.
</p>
- % if (my @connections = @{stash('connections') // []}) {
+ % if (my @connections = @{stash('connections_iris') // []}) {
<p>Alternative Reisemöglichkeiten:</p>
%= include '_connections', connections => \@connections, checkin_from => $journey->{dep_eva};
% }
diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep
index f3ecda4..2300ddd 100644
--- a/templates/_checked_in.html.ep
+++ b/templates/_checked_in.html.ep
@@ -199,19 +199,17 @@
</ul>
</p>
% }
- % if (my @connections = @{stash('connections') // []}) {
+ % if (@{stash('connections_iris') // [] } or @{stash('connections_hafas') // []}) {
<span class="card-title" style="margin-top: 2ex;">Verbindungen</span>
% if ($journey->{arrival_countdown} < 0) {
<p>Fahrt auswählen zum Einchecken mit Zielwahl.</p>
% }
- %= include '_connections', connections => \@connections, checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_eva} : undef;
- % }
- % if (my @transit_fyi = @{stash('transit_fyi') // []}) {
- <span class="card-title" style="margin-top: 2ex;">Nahverkehr</span>
- % if ($journey->{arrival_countdown} < 0) {
- <p>Nur zur Information – kein Checkin möglich.</p>
+ % if (@{stash('connections_iris') // [] }) {
+ %= include '_connections', connections => stash('connections_iris'), checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_eva} : undef;
+ % }
+ % if (@{stash('connections_hafas') // [] }) {
+ %= include '_connections_hafas', connections => stash('connections_hafas'), checkin_from => $journey->{arrival_countdown} < 0 ? $journey->{arr_eva} : undef;
% }
- %= include '_transit_fyi', transit_fyi => \@transit_fyi;
% }
% if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) {
<p style="margin-top: 2ex;">
diff --git a/templates/_checked_out.html.ep b/templates/_checked_out.html.ep
index 55ced95..98db660 100644
--- a/templates/_checked_out.html.ep
+++ b/templates/_checked_out.html.ep
@@ -3,10 +3,15 @@
<span class="card-title">Ausgecheckt</span>
<p>Aus <%= $journey->{train_type} %> <%= $journey->{train_no} %>
bis <a href="/s/<%= $journey->{arr_eva} %>?hafas=<%= $journey->{train_id} =~ m{[|]} ? 1 : 0 %>"><%= $journey->{arr_name} %></a></p>
- % if (my @connections = @{stash('connections') // []}) {
+ % if (@{stash('connections_iris') // [] } or @{stash('connections_hafas') // []}) {
<span class="card-title" style="margin-top: 2ex;">Verbindungen</span>
- <p>Zug auswählen zum Einchecken mit Zielwahl.</p>
- %= include '_connections', connections => \@connections, checkin_from => $journey->{arr_eva};
+ <p>Fahrt auswählen zum Einchecken mit Zielwahl.</p>
+ % if (@{stash('connections_iris') // [] }) {
+ %= include '_connections', connections => stash('connections_iris'), checkin_from => $journey->{arr_eva};
+ % }
+ % if (@{stash('connections_hafas') // [] }) {
+ %= include '_connections_hafas', connections => stash('connections_hafas'), checkin_from => $journey->{arr_eva};
+ % }
% }
</div>
<div class="card-action">
diff --git a/templates/_connections.html.ep b/templates/_connections.html.ep
index e4f1872..98be766 100644
--- a/templates/_connections.html.ep
+++ b/templates/_connections.html.ep
@@ -9,7 +9,7 @@
% $link_class = 'action-cancelled-from';
% }
% if ($checkin_from) {
- <tr class="<%= $link_class %>" data-station="<%= $train->station_uic %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>">
+ <tr class="<%= $link_class %>" data-station="<%= $train->station_uic %>" data-train="<%= $train->train_id %>" data-dest="<%= $via->{name} %>">
% }
% else {
<tr>
@@ -33,10 +33,10 @@
</td>
<td class="<%= $td_class %>">
% if ($checkin_from) {
- <a><%= $via %></a>
+ <a><%= $via->{name} %></a>
% }
% else {
- %= $via
+ %= $via->{name}
% }
<br/>
% if ($load) {
diff --git a/templates/_connections_hafas.html.ep b/templates/_connections_hafas.html.ep
new file mode 100644
index 0000000..9322116
--- /dev/null
+++ b/templates/_connections_hafas.html.ep
@@ -0,0 +1,59 @@
+<div><table class="striped"><tbody>
+ % for my $res (@{$connections}) {
+ % my ($train, $via, $via_arr) = @{$res};
+ % $via_arr = $via_arr ? $via_arr->strftime('%H:%M') : q{};
+ % my $td_class = '';
+ % my $link_class = 'action-checkin';
+ % if ($train->is_cancelled) {
+ % $td_class = 'cancelled';
+ % $link_class = 'action-cancelled-from';
+ % }
+ % if ($checkin_from) {
+ <tr class="<%= $link_class %>" data-station="<%= $train->station_eva %>" data-train="<%= $train->id %>" data-dest="<%= $via->{name} %>">
+ % }
+ % else {
+ <tr>
+ % }
+ <td class="<%= $td_class %>">
+ % if ($train->platform) {
+ % if ($checkin_from) {
+ <a>Gleis <%= $train->platform %></a>
+ % }
+ % else {
+ Gleis <%= $train->platform %>
+ % }
+ <br/>
+ % }
+ % if ($checkin_from) {
+ <a><%= $train->line %></a>
+ % }
+ % else {
+ %= $train->line
+ % }
+ </td>
+ <td class="<%= $td_class %>">
+ % if ($checkin_from) {
+ <a><%= $via->{name} %></a>
+ % }
+ % else {
+ %= $via->{name}
+ % }
+ </td>
+ <td>
+ % if ($train->is_cancelled) {
+ %= $train->sched_datetime->strftime('%H:%M')
+ ⊖
+ % }
+ % else {
+ %= $train->datetime->strftime('%H:%M')
+ % }
+ % if ($via_arr) {
+ → <%= $via_arr %>
+ % }
+ % if ($train->delay) {
+ %= sprintf('(%+d)', $train->delay)
+ % }
+ </td>
+ </tr>
+ % }
+</tbody></table></div>
diff --git a/templates/_transit_fyi.html.ep b/templates/_transit_fyi.html.ep
deleted file mode 100644
index 5951e7d..0000000
--- a/templates/_transit_fyi.html.ep
+++ /dev/null
@@ -1,22 +0,0 @@
-<table class="striped"><tbody>
- % for my $res (@{$transit_fyi}) {
- % my ($info, $via, $via_arr) = @{$res};
- % $via_arr = $via_arr ? $via_arr->strftime('%H:%M') : q{};
- <tr>
- <td>
- %= $info->{line}
- </td>
- <td>
- %= $via
- </td>
- <td>
- %= $info->{departure}->strftime('%H:%M')
- →
- %= $via_arr
- % if ($info->{departure_delay}) {
- %= sprintf('(%+d)', $info->{departure_delay})
- % }
- </td>
- </tr>
- % }
-</tbody></table>
diff --git a/templates/account.html.ep b/templates/account.html.ep
index fac5817..7f689c2 100644
--- a/templates/account.html.ep
+++ b/templates/account.html.ep
@@ -67,7 +67,7 @@
<th scope="row">Verbindungen</th>
<td>
<a href="/account/insight"><i class="material-icons">edit</i></a>
- % if ($use_history & 0x07) {
+ % if ($use_history & 0x03) {
Vorschläge aktiv
% }
% else {
diff --git a/templates/departures.html.ep b/templates/departures.html.ep
index 3a2516f..021e9ca 100644
--- a/templates/departures.html.ep
+++ b/templates/departures.html.ep
@@ -72,12 +72,17 @@
</div>
</div>
% }
-% elsif (not param('train') and my @connections = @{stash('connections') // []}) {
+% elsif (not param('train') and (@{stash('connections_iris') // []} or @{stash('connections_hafas') // []}) ) {
% $have_connections = 1;
<div class="row">
<div class="col s12">
<p>Häufig genutzte Verbindungen – Fahrt auswählen zum Einchecken mit Zielwahl</p>
- %= include '_connections', connections => \@connections, checkin_from => $eva;
+ % if (@{stash('connections_iris') // []}) {
+ %= include '_connections', connections => stash('connections_iris'), checkin_from => $eva;
+ % }
+ % if (@{stash('connections_hafas') // []}) {
+ %= include '_connections_hafas', connections => stash('connections_hafas'), checkin_from => $eva;
+ % }
</div>
</div>
% }
diff --git a/templates/use_history.html.ep b/templates/use_history.html.ep
index e90f17f..9b76e98 100644
--- a/templates/use_history.html.ep
+++ b/templates/use_history.html.ep
@@ -48,30 +48,6 @@
</div>
</div>
<div class="row">
- <div class="input-field col s12">
- <label>
- %= check_box local_transit => 1
- <span>Nahverkehr</span>
- </label>
- </div>
- </div>
- <div class="row">
- <div class="col s12">
- Zeige beim Reisestatus zusätzlich Anschlussmöglichkeiten an den
- Nahverkehr. Diese dienen lediglich zur Information; ein Checkin ist
- nicht möglich. Es werden nur Anschlussmöglichkeiten zu Zielen
- angezeigt, die im folgenden Feld gelistet sind (ein Ziel pro
- Zeile, z.B. „Eichlinghofen H-Bahn, Dortmund“). Falls travelynx in
- Zukunft eine Möglichkeit für Checkins in Nahverkehrsmittel erhält,
- wird diese Liste ggf. gelöscht.
- </div>
- </div>
- <div class="row">
- <div class="col s12">
- %= text_area 'destinations', id => 'destinations', class => 'materialize-textarea'
- </div>
- </div>
- <div class="row">
<div class="col s3 m3 l3">
</div>
<div class="col s6 m6 l6 center-align">