summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-05-19 10:32:57 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-05-19 10:32:57 +0200
commitd9d3aac79200ca7d896d753c897e1651517ecf36 (patch)
tree87194b7a8b67b7b09bd2dc357e5239099dd60430 /templates
parent7960114f71720f2c2fa86e74be4b80812edaef36 (diff)
allow checkin from connections view
Diffstat (limited to 'templates')
-rw-r--r--templates/_checked_in.html.ep30
-rw-r--r--templates/_checked_out.html.ep5
-rw-r--r--templates/_connections.html.ep60
-rw-r--r--templates/layouts/default.html.ep2
4 files changed, 67 insertions, 30 deletions
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()) {
- <span class="card-title" style="margin-top: 2ex;">Verbindungen</span>
- <div class="hide-on-med-and-up"><table><tbody>
- % for my $res (@connections) {
- % my ($train, $via) = @{$res};
- <tr>
- <td><%= $train->line %></td>
- <td><%= $via %></td>
- <td><%= $train->departure->strftime('%H:%M') %>
- % if ($train->departure_delay) {
- %= sprintf('(%+d)', $train->departure_delay)
- % }
- <br/>Gleis <%= $train->platform %></td>
- </tr>
- % }
- </tbody></table></div>
- <div class="hide-on-small-only"><table><tbody>
- % for my $res (@connections) {
- % my ($train, $via) = @{$res};
- <tr>
- <td><%= $train->line %></td>
- <td><%= $via %></td>
- <td><%= $train->departure->strftime('%H:%M') %>
- % if ($train->departure_delay) {
- %= sprintf('(%+d)', $train->departure_delay)
- % }
- </td><td>Gleis <%= $train->platform %></td>
- </tr>
- % }
- </tbody></table></div>
+ %= 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 @@
<span class="card-title">Ausgecheckt</span>
<p>Aus <%= $journey->{train_type} %> <%= $journey->{train_no} %>
bis <a href="/s/<%= $journey->{arr_ds100} %>"><%= $journey->{arr_name} %></a></p>
+ % if (now()->epoch - $journey->{timestamp}->epoch < (30*60)) {
+ % if (my @connections = get_connecting_trains()) {
+ %= include '_connections', connections => \@connections, checkin_from => $journey->{arr_ds100};
+ % }
+ % }
</div>
<div class="card-action">
<a class="action-undo" data-id="<%= $journey->{journey_id} %>">
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 @@
+<span class="card-title" style="margin-top: 2ex;">Verbindungen</span>
+% if ($checkin_from) {
+ <p>Zug auswählen zum Einchecken mit Zielwahl.</p>
+% }
+<div class="hide-on-med-and-up"><table><tbody>
+ % for my $res (@{$connections}) {
+ % my ($train, $via) = @{$res};
+ <tr>
+ <td>
+ % if ($checkin_from) {
+ <a class="action-checkin" data-station="<%= $checkin_from %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $train->line %></a>
+ % }
+ % else {
+ %= $train->line
+ % }
+ </td>
+ <td>
+ % if ($checkin_from) {
+ <a class="action-checkin" data-station="<%= $checkin_from %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $via %></a>
+ % }
+ % else {
+ %= $via
+ % }
+ </td>
+ <td><%= $train->departure->strftime('%H:%M') %>
+ % if ($train->departure_delay) {
+ %= sprintf('(%+d)', $train->departure_delay)
+ % }
+ <br/>Gleis <%= $train->platform %></td>
+ </tr>
+ % }
+</tbody></table></div>
+<div class="hide-on-small-only"><table><tbody>
+ % for my $res (@{$connections}) {
+ % my ($train, $via) = @{$res};
+ <tr>
+ <td>
+ % if ($checkin_from) {
+ <a class="action-checkin" data-station="<%= $checkin_from %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $train->line %></a>
+ % }
+ % else {
+ %= $train->line
+ % }
+ </td>
+ <td>
+ % if ($checkin_from) {
+ <a class="action-checkin" data-station="<%= $checkin_from %>" data-train="<%= $train->train_id %>" data-dest="<%= $via %>"><%= $via %></a>
+ % }
+ % else {
+ %= $via
+ % }
+ </td>
+ <td><%= $train->departure->strftime('%H:%M') %>
+ % if ($train->departure_delay) {
+ %= sprintf('(%+d)', $train->departure_delay)
+ % }
+ </td><td>Gleis <%= $train->platform %></td>
+ </tr>
+ % }
+</tbody></table></div>
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 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Travelynx">
- % my $av = 'v23'; # asset version
+ % my $av = 'v24'; # asset version
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/static/<%= $av %>/icons/icon-96x96.png" sizes="96x96">