summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-03-07 18:36:11 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-03-07 18:36:11 +0100
commitfd608391164ddc9e55e2f383620d395b43ae99b7 (patch)
treed7718f37e273918933d42f6d488fa70d78f0b1d6 /templates
parentba6b517e5b6986609996339eae109bb2c279ee5f (diff)
switch from HTTP Auth to Cookie Auth
Diffstat (limited to 'templates')
-rw-r--r--templates/account.html.ep2
-rw-r--r--templates/landingpage.html.ep137
-rw-r--r--templates/layouts/default.html.ep23
-rw-r--r--templates/login.html.ep4
-rw-r--r--templates/register.html.ep4
5 files changed, 89 insertions, 81 deletions
diff --git a/templates/account.html.ep b/templates/account.html.ep
index 9c3a435..c3f24f8 100644
--- a/templates/account.html.ep
+++ b/templates/account.html.ep
@@ -22,7 +22,7 @@
<div class="row">
<div class="col s12">
<ul>
- <li><a href="/a/export.json">Rohdaten</a> (Kein API-Ersatz, das Format kann sich jederzeit ändern)</li>
+ <li><a href="/export.json">Rohdaten</a> (Kein API-Ersatz, das Format kann sich jederzeit ändern)</li>
</ul>
</div>
</div>
diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep
index 00a67cc..4c6a8f2 100644
--- a/templates/landingpage.html.ep
+++ b/templates/landingpage.html.ep
@@ -1,72 +1,77 @@
-<div class="row">
- <div class="col s12">
- % my $status = $self->get_user_status;
- % if ($status->{checked_in}) {
- <div class="card green darken-4">
- <div class="card-content white-text">
- <span class="card-title">Hallo, <%= $self->get_user_name %>!</span>
- <p>Du bist gerade eingecheckt in
- <%= $status->{train_type} %> <%= $status->{train_no} %>
- ab <%= $status->{station_name} %>.
- % if ($status->{timestamp_delta} < 3600) {
- <a class="action-undo"><i class="material-icons">undo</i> Rückgängig</a>
- % }
- </p>
- <p>Auschecken?</p>
- <table>
- <tbody>
- % my $is_after = 0;
- % for my $station (@{$status->{route_after}}) {
- <tr><td><a class="action-checkout" data-station="<%= $station %>"><%= $station %></a></td></tr>
+% if (is_user_authenticated()) {
+ <div class="row">
+ <div class="col s12">
+ % my $status = get_user_status();
+ % if ($status->{checked_in}) {
+ <div class="card green darken-4">
+ <div class="card-content white-text">
+ <span class="card-title">Hallo, <%= current_user()->{name} %>!</span>
+ <p>Du bist gerade eingecheckt in
+ <%= $status->{train_type} %> <%= $status->{train_no} %>
+ ab <%= $status->{station_name} %>.
+ % if ($status->{timestamp_delta} < 3600) {
+ <a class="action-undo"><i class="material-icons">undo</i> Rückgängig</a>
% }
- </tbody>
- </table>
+ </p>
+ <p>Auschecken?</p>
+ <table>
+ <tbody>
+ % my $is_after = 0;
+ % for my $station (@{$status->{route_after}}) {
+ <tr><td><a class="action-checkout" data-station="<%= $station %>"><%= $station %></a></td></tr>
+ % }
+ </tbody>
+ </table>
+ </div>
</div>
- </div>
- % }
- % else {
- <div class="card grey darken-4">
- <div class="card-content white-text">
- <span class="card-title">Hallo, <%= $self->get_user_name %>!</span>
- <p>Du bist gerade nicht eingecheckt.</p>
- <p class="geolocationhint">Stationen in der Umgebung:</p>
- <div class="geolocation">
- <div class="progress"><div class="indeterminate"></div></div>
+ % }
+ % else {
+ <div class="card grey darken-4">
+ <div class="card-content white-text">
+ <span class="card-title">Hallo, <%= current_user()->{name} %>!</span>
+ <p>Du bist gerade nicht eingecheckt.</p>
+ <p class="geolocationhint">Stationen in der Umgebung:</p>
+ <div class="geolocation">
+ <div class="progress"><div class="indeterminate"></div></div>
+ </div>
</div>
</div>
- </div>
- % }
+ % }
+ </div>
</div>
-</div>
-<h1>Letzte 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(1)) {
- % 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}->epoch and $travel->{rt_departure}->epoch) {
- <td><%= ($travel->{rt_arrival}->epoch - $travel->{rt_departure}->epoch) / 60 %> min
- </td>
- % } else {
- <td><%= sprintf('%.f', $self->get_travel_distance($travel->{from_name}, $travel->{to_name}, $travel->{route})) %>km
- <i class="material-icons">timer_off</i>
- </td>
- % }
- </tr>
+ <h1>Letzte 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(1)) {
+ % 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}->epoch and $travel->{rt_departure}->epoch) {
+ <td><%= ($travel->{rt_arrival}->epoch - $travel->{rt_departure}->epoch) / 60 %> min
+ </td>
+ % } else {
+ <td><%= sprintf('%.f', $self->get_travel_distance($travel->{from_name}, $travel->{to_name}, $travel->{route})) %>km
+ <i class="material-icons">timer_off</i>
+ </td>
+ % }
+ </tr>
+ % }
% }
- % }
- </tbody>
- </tabel>
-</div>
+ </tbody>
+ </tabel>
+ </div>
+% }
+% else {
+Huhu!
+% }
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep
index cbe06e3..3fdb075 100644
--- a/templates/layouts/default.html.ep
+++ b/templates/layouts/default.html.ep
@@ -5,14 +5,15 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#673ab7">
- %= stylesheet '/static/css/materialize.min.css'
- %= stylesheet '/static/css/material-icons.css'
- %= stylesheet '/static/css/local.css'
- %= javascript '/static/js/jquery-2.2.4.min.js'
- %= javascript '/static/js/materialize.min.js'
- %= javascript '/static/js/travelynx-actions.min.js'
+ % my $av = 'v1'; # asset version
+ %= stylesheet "/static/${av}/css/materialize.min.css"
+ %= stylesheet "/static/${av}/css/material-icons.css"
+ %= stylesheet "/static/${av}/css/local.css"
+ %= javascript "/static/${av}/js/jquery-2.2.4.min.js"
+ %= javascript "/static/${av}/js/materialize.min.js"
+ %= javascript "/static/${av}/js/travelynx-actions.min.js"
% if (stash('with_geolocation')) {
- %= javascript '/static/js/geolocation.min.js'
+ %= javascript "/static/${av}/js/geolocation.min.js"
% }
</head>
<body>
@@ -21,9 +22,11 @@
<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('/a/account') %>"><a href="/a/account" title="Account"><i class="material-icons">account_circle</i></a></li>
- <li class="<%= navbar_class('/x/about') %>"><a href='/x/about' title="About"><i class="material-icons">info_outline</i></a></li>
+ % if (is_user_authenticated()) {
+ <li class="<%= navbar_class('/history') %>"><a href='/history' title="History"><i class="material-icons">history</i></a></li>
+ <li class="<%= navbar_class('/account') %>"><a href="/account" title="Account"><i class="material-icons">account_circle</i></a></li>
+ % }
+ <li class="<%= navbar_class('/about') %>"><a href='/about' title="About"><i class="material-icons">info_outline</i></a></li>
</ul>
</div>
</nav>
diff --git a/templates/login.html.ep b/templates/login.html.ep
index 37afacc..f85ba91 100644
--- a/templates/login.html.ep
+++ b/templates/login.html.ep
@@ -7,7 +7,7 @@
<p>
Du bist bereits angemeldet. Falls du mehrere Accounts hast
und auf einen anderen wechseln möchtest, musst du dich
- vorher <a href="/x/logout">abmelden</a>.
+ vorher <a href="/logout">abmelden</a>.
</p>
</div>
</div>
@@ -64,7 +64,7 @@
</div>
% }
<div class="row">
- %= form_for '/x/login' => (class => 'col s12', method => 'POST') => begin
+ %= form_for '/login' => (class => 'col s12', method => 'POST') => begin
%= csrf_field
<div class="row">
<div class="input-field col s12">
diff --git a/templates/register.html.ep b/templates/register.html.ep
index a227e6f..d1e189d 100644
--- a/templates/register.html.ep
+++ b/templates/register.html.ep
@@ -59,7 +59,7 @@
</div>
% }
<div class="row">
- %= form_for '/x/register' => (class => 'col s12', method => 'POST') => begin
+ %= form_for '/register' => (class => 'col s12', method => 'POST') => begin
%= csrf_field
<div class="row">
<div class="input-field col l6 m12 s12">
@@ -103,7 +103,7 @@
Die Mail-Adresse wird ausschließlich zur Bestätigung der Anmeldung
und für die "Passwort vergessen"-Funktionalität verwendet und nicht
an Dritte weitergegeben. Die <a
- href="/x/impressum">Datenschutzerklärung</a> beschreibt weitere
+ href="/impressum">Datenschutzerklärung</a> beschreibt weitere
erhobene Daten sowie deren Zweck und Speicherfristen.
Accounts werden nach einem Jahr ohne Nutzung automatisch gelöscht.
</p>