From f0d61a4083d677e115040357f4ee6eb40fb817f9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 30 Apr 2019 23:23:49 +0200 Subject: Prepare settings and templates for opt-in public travel status --- templates/_public_status_card.html.ep | 87 +++++++++++++++++++++++++++++++++++ templates/account.html.ep | 14 ++++++ templates/privacy.html.ep | 42 +++++++++++++++++ templates/user_status.html.ep | 5 ++ 4 files changed, 148 insertions(+) create mode 100644 templates/_public_status_card.html.ep create mode 100644 templates/privacy.html.ep create mode 100644 templates/user_status.html.ep (limited to 'templates') diff --git a/templates/_public_status_card.html.ep b/templates/_public_status_card.html.ep new file mode 100644 index 0000000..1b33c18 --- /dev/null +++ b/templates/_public_status_card.html.ep @@ -0,0 +1,87 @@ +% if ($journey->{checked_in}) { +
+
+ <%= $name %> ist unterwegs +

+ In <%= $journey->{train_type} %> <%= $journey->{train_no} %> + % if ($journey->{arr_name}) { + von <%= $journey->{dep_name} %> nach <%= $journey->{arr_name} %>. + % } + % else { + ab <%= $journey->{dep_name} %>. + % } +

+

+ <%= $journey->{real_departure}->strftime('%H:%M') %> + % if ($journey->{real_departure}->epoch != $journey->{sched_departure}->epoch) { + (<%= sprintf('%+d', ($journey->{real_departure}->epoch - $journey->{sched_departure}->epoch)/60) %>) + % } + → + % if ($journey->{real_arrival}->epoch) { + <%= $journey->{real_arrival}->strftime('%H:%M') %> + % if ($journey->{real_arrival}->epoch != $journey->{sched_arrival}->epoch) { + (<%= sprintf('%+d', ($journey->{real_arrival}->epoch - $journey->{sched_arrival}->epoch)/60) %>) + % } + % } + % elsif ($journey->{arr_name}) { + noch nicht bekannt + % } + % else { + unbekannt + % } +

+

+

+ % if ($journey->{departure_countdown} > 120) { + Abfahrt in <%= sprintf('%.f', $journey->{departure_countdown} / 60) %> Minuten + % } + % elsif ($journey->{departure_countdown} > 60) { + Abfahrt in einer Minute + % } + % elsif ($journey->{departure_countdown} > 0) { + Abfahrt in weniger als einer Minute + % } + % elsif (defined $journey->{arrival_countdown}) { + % if ($journey->{arrival_countdown} > 60) { + Ankunft in <%= sprintf('%.f', $journey->{arrival_countdown} / 60) %> + Minute<%= sprintf('%.f', $journey->{arrival_countdown} / 60) == 1 ? '' : 'n' %> + % } + % elsif ($journey->{arrival_countdown} > 0) { + Ankunft in weniger als einer Minute + % } + % else { + Ziel erreicht + % } + % } + % elsif ($journey->{arr_name}) { + Ankunft in mehr als zwei Stunden + % } +
+
+
+
+

+ % if (@{$journey->{messages} // []} > 0 and $journey->{messages}[0]) { +

+

    + % for my $message (reverse @{$journey->{messages} // []}) { + % if ($journey->{sched_departure}->epoch - $message->[0]->epoch < 1800) { +
  • warning <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %>
  • + % } + % } +
+

+ % } +
+
+% } +% else { +
+
+ <%= $name %> ist gerade nicht eingecheckt +

+ Zuletzt gesehen in <%= $journey->{arr_name} %>. +

+
+
+% } diff --git a/templates/account.html.ep b/templates/account.html.ep index 92b61db..076adf1 100644 --- a/templates/account.html.ep +++ b/templates/account.html.ep @@ -36,6 +36,20 @@ Passwort edit ändern + + Privatsphäre + + % if ($acc->{is_public} == 0) { + Keine öffentlichen Daten + % } + % else { + Öffentliche Daten: + % } + % if ($acc->{is_public} & 0x02) { + Status + % } + edit ändern + Registriert am <%= $acc->{registered_at}->strftime('%d.%m.%Y %H:%M') %> diff --git a/templates/privacy.html.ep b/templates/privacy.html.ep new file mode 100644 index 0000000..bf509ce --- /dev/null +++ b/templates/privacy.html.ep @@ -0,0 +1,42 @@ +

Privatsphäre

+
+
+ Hier kannst du auswählen, welche Aspekte deines Accounts bzw. deiner + Bahnfahrten öffentlich einsehbar sind. Öffentliche Daten sind + grundsätzlich für alle einsehbar, die die (leicht erratbare) URL + kennen. +
+
+

Öffentliche Daten:

+%= form_for '/account/privacy' => (method => 'POST') => begin + %= csrf_field +
+
+ +
+
+
+
+ Wenn aktiv, ist dein aktueller Status unter /status/<%= $name %> abrufbar. Wenn du eingecheckt bist, + werden dort Zug, Start- und Zielstation, Abfahrts- und Ankunftszeit + gezeigt; andernfalls lediglich der Zielbahnhof der letzten Reise. + Wann die letzte Reise beendet wurde, wird bewusst nicht angegeben. +
+
+
+
+
+
+ +
+
+
+
+%= end diff --git a/templates/user_status.html.ep b/templates/user_status.html.ep new file mode 100644 index 0000000..7691258 --- /dev/null +++ b/templates/user_status.html.ep @@ -0,0 +1,5 @@ +
+
+ %= include '_public_status_card', name => $name, journey => $journey +
+
-- cgit v1.2.3