summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-13 14:40:19 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-13 14:40:19 +0200
commitb070e55eaeb6df7cb39235463ca7df7dd2c6bcc0 (patch)
tree99e06765c1fee7726e601cd95de376929643d098
parent33fd338bc54f81338d32c6eba6c59f3b35dbe545 (diff)
add history page
-rwxr-xr-xindex.pl6
-rw-r--r--templates/history.html.ep30
-rw-r--r--templates/layouts/default.html.ep1
3 files changed, 37 insertions, 0 deletions
diff --git a/index.pl b/index.pl
index 24cdc91..bb3fee8 100755
--- a/index.pl
+++ b/index.pl
@@ -647,6 +647,12 @@ post '/action' => sub {
}
};
+get '/a/history' => sub {
+ my ($self) = @_;
+
+ $self->render('history');
+};
+
get '/x/about' => sub {
my ($self) = @_;
diff --git a/templates/history.html.ep b/templates/history.html.ep
new file mode 100644
index 0000000..3c798a4
--- /dev/null
+++ b/templates/history.html.ep
@@ -0,0 +1,30 @@
+<h1>Bisherige Fahrten</h1>
+<div class="row">
+ <table class="striped">
+ <thead>
+ <tr>
+ <th>Datum</th>
+ <th>Zug</th>
+ <th>Strecke</th>
+ <th>Dauer</th>
+ </tr>
+ </thead>
+ <tbody>
+ % for my $travel (get_user_travels(0)) {
+ % if ($travel->{completed}) {
+ <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>
+ % if ($travel->{rt_arrival} and $travel->{rt_departure}) {
+ <td><%= ($travel->{rt_arrival}->epoch - $travel->{rt_departure}->epoch) / 60 %> min</td>
+ % }
+ % else {
+ <td>?</td>
+ % }
+ </tr>
+ % }
+ % }
+ </tbody>
+ </tabel>
+</div>
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep
index 2e07ffe..19be177 100644
--- a/templates/layouts/default.html.ep
+++ b/templates/layouts/default.html.ep
@@ -21,6 +21,7 @@
<div class="nav-wrapper container">
<a href="/" class="brand-logo left">travelynx</a>
<ul id="nav-mobile" class="right">
+ <li class="<%= navbar_class('/a/history') %>"><a href='/a/history' title="History"><i class="material-icons">history</i></a></li>
<li class="<%= navbar_class('/x/about') %>"><a href='/x/about' title="About"><i class="material-icons">info_outline</i></a></li>
</ul>
</div>