summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/history.html.ep7
-rw-r--r--templates/journey.html.ep101
-rw-r--r--templates/landingpage.html.ep7
3 files changed, 109 insertions, 6 deletions
diff --git a/templates/history.html.ep b/templates/history.html.ep
index cf81765..d79b515 100644
--- a/templates/history.html.ep
+++ b/templates/history.html.ep
@@ -19,12 +19,13 @@
</tr>
</thead>
<tbody>
- % for my $travel (get_user_travels(0)) {
+ % for my $travel (get_user_travels()) {
% if ($travel->{completed}) {
+ % my $detail_link = '/journey/' . current_user()->{id} . '-' . $travel->{checkin}->epoch . '-' . $travel->{checkout}->epoch;
<tr>
<td><%= $travel->{sched_departure}->strftime('%d.%m.%Y') %></td>
- <td><%= $travel->{type} %> <%= $travel->{line} // '' %> <%= $travel->{no} %></td>
- <td><%= $travel->{from_name} %> → <%= $travel->{to_name} %></td>
+ <td><a href="<%= $detail_link %>"><%= $travel->{type} %> <%= $travel->{line} // '' %> <%= $travel->{no} %></a></td>
+ <td><a href="<%= $detail_link %>"><%= $travel->{from_name} %> → <%= $travel->{to_name} %></a></td>
<td><%= $travel->{rt_departure}->strftime('%H:%M') %>
% if ($travel->{sched_departure} != $travel->{rt_departure}) {
(+<%= ($travel->{rt_departure}->epoch - $travel->{sched_departure}->epoch) / 60 %>)
diff --git a/templates/journey.html.ep b/templates/journey.html.ep
new file mode 100644
index 0000000..520b2ef
--- /dev/null
+++ b/templates/journey.html.ep
@@ -0,0 +1,101 @@
+% if ($error) {
+ <div class="row">
+ <div class="col s12">
+ <div class="card red darken-4">
+ <div class="card-content white-text">
+ <span class="card-title">Fehler</span>
+ <p>Zugfahrt nicht gefunden.<p/>
+ </div>
+ </div>
+ </div>
+ </div>
+% }
+% else {
+ <div class="row">
+ <div class="col s12">
+ <p>
+ Fahrt von
+ <b><%= $journey->{from_name} %></b>
+ nach
+ <b><%= $journey->{to_name} %></b>
+ am
+ <b><%= $journey->{sched_departure}->strftime('%d.%m.%Y') %></b>
+ </p>
+ <table class="striped">
+ <tr>
+ <th scope="row">Zug</th>
+ <td>
+ <%= $journey->{type} %> <%= $journey->{no} %>
+ % if ($journey->{line}) {
+ (Linie <%= $journey->{type} %> <%= $journey->{line} %>)
+ % }
+ </td>
+ </tr>
+ <tr>
+ <th scope="row">Abfahrt</th>
+ <td>
+ % if ($journey->{rt_departure} != $journey->{sched_departure}) {
+ %= $journey->{rt_departure}->strftime('%H:%M');
+ (+<%= ($journey->{rt_departure}->epoch - $journey->{sched_departure}->epoch) / 60 %>,
+ Plan: <%= $journey->{sched_departure}->strftime('%H:%M'); %>)
+ % }
+ % else {
+ %= $journey->{sched_departure}->strftime('%H:%M');
+ % }
+ </td>
+ </tr>
+ <tr>
+ <th scope="row">Ankunft</th>
+ <td>
+ % if ($journey->{rt_arrival}->epoch == 0 and $journey->{sched_arrival}->epoch == 0) {
+ <i class="material-icons">timer_off</i>
+ % }
+ % elsif ($journey->{rt_arrival} != $journey->{sched_arrival}) {
+ %= $journey->{rt_arrival}->strftime('%H:%M');
+ (+<%= ($journey->{rt_arrival}->epoch - $journey->{sched_arrival}->epoch) / 60 %>,
+ Plan: <%= $journey->{sched_arrival}->strftime('%H:%M'); %>)
+ % }
+ % else {
+ %= $journey->{sched_arrival}->strftime('%H:%M');
+ % }
+ </td>
+ </tr>
+ <tr>
+ <th scope="row">Meldungen</th>
+ <td>
+ % for my $message (@{$journey->{messages} // []}) {
+ % my ($ts, $msg) = @{$message};
+ <%= $ts->strftime('%d.%m.%Y %H:%M') %> : <%= $msg %>
+ % }
+ <br/>
+ </td>
+ </tr>
+ <tr>
+ <th scope="row">Route</th>
+ <td>
+ % my $within = 0;
+ % my $at_startstop = 0;
+ % for my $station (@{$journey->{route}}) {
+ % if ($station eq $journey->{from_name}) {
+ % $within = 1; $at_startstop = 1;
+ % }
+ % elsif ($station eq $journey->{to_name}) {
+ % $within = 0; $at_startstop = 1;
+ % }
+ % else {
+ % $at_startstop = 0;
+ % }
+ % if ($at_startstop or $within) {
+ <%= $station %>
+ % }
+ % else {
+ <span style="color: #666666;"><%= $station %></span>
+ % }
+ <br/>
+ % }
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+% }
diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep
index c672dd2..dcc0083 100644
--- a/templates/landingpage.html.ep
+++ b/templates/landingpage.html.ep
@@ -75,12 +75,13 @@
</tr>
</thead>
<tbody>
- % for my $travel (get_user_travels(1)) {
+ % for my $travel (get_user_travels(limit => 1)) {
% if ($travel->{completed}) {
<tr>
+ % my $detail_link = '/journey/' . current_user()->{id} . '-' . $travel->{checkin}->epoch . '-' . $travel->{checkout}->epoch;
<td><%= $travel->{sched_departure}->strftime('%d.%m.%Y') %></td>
- <td><%= $travel->{type} %> <%= $travel->{line} // $travel->{no} %></td>
- <td><%= $travel->{from_name} %> → <%= $travel->{to_name} %></td>
+ <td><a href="<%= $detail_link %>"><%= $travel->{type} %> <%= $travel->{line} // $travel->{no} %></a></td>
+ <td><a href="<%= $detail_link %>"><%= $travel->{from_name} %> → <%= $travel->{to_name} %></a></td>
% if ($travel->{rt_arrival}->epoch and $travel->{rt_departure}->epoch) {
<td><%= ($travel->{rt_arrival}->epoch - $travel->{rt_departure}->epoch) / 60 %> min
</td>