summaryrefslogtreecommitdiff
path: root/templates/_public_status_card.html.ep
diff options
context:
space:
mode:
Diffstat (limited to 'templates/_public_status_card.html.ep')
-rw-r--r--templates/_public_status_card.html.ep128
1 files changed, 75 insertions, 53 deletions
diff --git a/templates/_public_status_card.html.ep b/templates/_public_status_card.html.ep
index 907427f..b463d15 100644
--- a/templates/_public_status_card.html.ep
+++ b/templates/_public_status_card.html.ep
@@ -1,35 +1,47 @@
-<div class="autorefresh">
+<div class="autorefresh" data-from-profile="<%= stash('from_profile') ? 1 : 0 %>">
% if ($journey->{checked_in}) {
<div class="card">
<div class="card-content">
- <i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
- <span class="card-title"><%= $name %> ist unterwegs</span>
- % if ($public_level & 0x04 and $journey->{comment}) {
+ <i class="material-icons right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
+ <span class="card-title">
+ % if (stash('from_profile')) {
+ Unterwegs mit <%= include '_format_train', journey => $journey %>
+ % }
+ % elsif (stash('from_timeline')) {
+ <a href="/p/<%= $name %>"><%= $name %></a>: <%= include '_format_train', journey => $journey %>
+ % }
+ % else {
+ <a href="/p/<%= $name %>"><%= $name %></a> ist unterwegs
+ % }
+ <i class="material-icons right"><%= visibility_icon($journey->{effective_visibility_str}) %></i>
+ % if (not $journey->{extra_data}{rt}) {
+ <i class="material-icons right grey-text">gps_off</i>
+ % }
+ </span>
+ % if ($privacy->{comments_visible} and $journey->{comment}) {
<p>„<%= $journey->{comment} %>“</p>
% }
<p>
- % if ($journey->{train_line}) {
- <div class="center-align"><b><%= $journey->{train_type} %> <%= $journey->{train_line} %></b> <%= $journey->{train_no} %></div>
- % }
- % else {
- <div class="center-align"><b><%= $journey->{train_type} %> <%= $journey->{train_no} %></b></div>
+ % if (not stash('from_profile') and not stash('from_timeline')) {
+ <div class="center-align">
+ %= include '_format_train', journey => $journey
+ </div>
% }
<div class="center-align countdown"
data-duration="<%= $journey->{journey_duration} // 0 %>"
- data-arrival="<%= $journey->{real_arrival}->epoch %>">
- % if ($journey->{departure_countdown} > 120) {
- Abfahrt in <%= sprintf('%.f', $journey->{departure_countdown} / 60) %> Minuten
+ % if (param('token')) {
+ data-token="<%= $journey->{dep_eva} %>-<%= $journey->{timestamp}->epoch % 337 %>-<%= $journey->{sched_departure}->epoch %>"
% }
- % elsif ($journey->{departure_countdown} > 60) {
- Abfahrt in einer Minute
+ data-arrival="<%= $journey->{real_arrival}->epoch %>">
+ % if ($journey->{departure_countdown} > 60) {
+ Abfahrt in <%= journeys->min_to_human(int($journey->{departure_countdown} / 60)) %>
% }
% 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' %>
+ Ankunft in <%= journeys->min_to_human(int($journey->{arrival_countdown} / 60)) %>
% }
% elsif ($journey->{arrival_countdown} > 0) {
Ankunft in weniger als einer Minute
@@ -79,19 +91,21 @@
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
% last;
% }
- % if (($station->[1]{rt_arr_countdown} // 0) > 0) {
- <%= $station->[0] %><br/><%= $station->[1]{rt_arr}->strftime('%H:%M') %>
- % if ($station->[1]{sched_arr}->epoch != $station->[1]{rt_arr}->epoch) {
- %= sprintf('(%+d)', ($station->[1]{rt_arr}->epoch - $station->[1]{sched_arr}->epoch ) / 60);
+ % if (($station->[2]{arr_countdown} // 0) > 0 and $station->[2]{arr}) {
+ <%= $station->[0] %><br/><%= $station->[2]{arr}->strftime('%H:%M') %>
+ % if ($station->[2]{arr_delay}) {
+ %= sprintf('(%+d)', $station->[2]{arr_delay} / 60);
% }
% last;
% }
- % if (($station->[1]{rt_dep_countdown} // 0) > 0) {
+ % if (($station->[2]{dep_countdown} // 0) > 0 and $station->[2]{dep}) {
<%= $station->[0] %><br/>
- <%= $station->[1]{rt_arr}->strftime('%H:%M') %> →
- <%= $station->[1]{rt_dep}->strftime('%H:%M') %>
- % if ($station->[1]{sched_dep}->epoch != $station->[1]{rt_dep}->epoch) {
- %= sprintf('(%+d)', ($station->[1]{rt_dep}->epoch - $station->[1]{sched_dep}->epoch ) / 60);
+ % if ($station->[2]{arr}) {
+ <%= $station->[2]{arr}->strftime('%H:%M') %> →
+ % }
+ %= $station->[2]{dep}->strftime('%H:%M')
+ % if ($station->[2]{dep_delay}) {
+ %= sprintf('(%+d)', $station->[2]{dep_delay} / 60);
% }
% last;
% }
@@ -104,21 +118,21 @@
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
% last;
% }
- % if (($station->[1]{rt_arr_countdown} // 0) > 0) {
+ % if (($station->[2]{arr_countdown} // 0) > 0 and $station->[2]{arr}) {
Nächster Halt:<br/>
- <%= $station->[0] %><br/><%= $station->[1]{rt_arr}->strftime('%H:%M') %>
- % if ($station->[1]{sched_arr}->epoch != $station->[1]{rt_arr}->epoch) {
- %= sprintf('(%+d)', ($station->[1]{rt_arr}->epoch - $station->[1]{sched_arr}->epoch ) / 60);
+ <%= $station->[0] %><br/><%= $station->[2]{arr}->strftime('%H:%M') %>
+ % if ($station->[2]{arr_delay}) {
+ %= sprintf('(%+d)', $station->[2]{arr_delay} / 60);
% }
% last;
% }
- % if (($station->[1]{rt_dep_countdown} // 0) > 0) {
+ % if (($station->[2]{dep_countdown} // 0) > 0 and $station->[2]{arr} and $station->[2]{dep}) {
Aktueller Halt:<br/>
<%= $station->[0] %><br/>
- <%= $station->[1]{rt_arr}->strftime('%H:%M') %> →
- <%= $station->[1]{rt_dep}->strftime('%H:%M') %>
- % if ($station->[1]{sched_dep}->epoch != $station->[1]{rt_dep}->epoch) {
- %= sprintf('(%+d)', ($station->[1]{rt_dep}->epoch - $station->[1]{sched_dep}->epoch ) / 60);
+ <%= $station->[2]{arr}->strftime('%H:%M') %> →
+ <%= $station->[2]{dep}->strftime('%H:%M') %>
+ % if ($station->[2]{dep_delay}) {
+ %= sprintf('(%+d)', $station->[2]{dep_delay} / 60);
% }
% last;
% }
@@ -147,35 +161,43 @@
</p>
% }
</div>
- <div class="card-action">
- % my $url = 'https://marudor.de/details/' . $journey->{train_type} . ' ' . $journey->{train_no} . '/' . DateTime->now(time_zone => 'Europe/Berlin')->epoch . '000';
- <a style="margin-right: 0;" href="<%= $url %>"><i class="material-icons left">timeline</i> Zuglauf</a>
- % if ($journey->{extra_data}{trip_id}) {
- <a class="right" style="margin-right: 0;" href="https://dbf.finalrewind.org/map/<%= $journey->{extra_data}{trip_id} %>/<%= $journey->{train_line} || 0 %>?from=<%= $journey->{dep_name} %>&amp;to=<%= $journey->{arr_name} // '' %>"><i class="material-icons left">map</i> Karte</a>
- % }
- </div>
+ % if (not stash('from_timeline')) {
+ <div class="card-action">
+ % if ($journey->{traewelling_url}) {
+ <a style="margin-right: 0;" href="<%= $journey->{traewelling_url} %>"><i class="material-icons left">timeline</i> Träwelling</a>
+ % } else {
+ % my $url = 'https://bahn.expert/details/' . $journey->{train_type} . ' ' . $journey->{train_no} . '/' . DateTime->now(time_zone => 'Europe/Berlin')->epoch . '000';
+ <a style="margin-right: 0;" href="<%= $url %>"><i class="material-icons left">timeline</i> Zuglauf</a>
+ % }
+ % if ($journey->{extra_data}{trip_id}) {
+ <a class="right" style="margin-right: 0;" href="https://dbf.finalrewind.org/map/<%= $journey->{extra_data}{trip_id} %>/<%= $journey->{train_line} || 0 %>?from=<%= $journey->{dep_name} %>&amp;to=<%= $journey->{arr_name} // '' %>"><i class="material-icons left">map</i> Karte</a>
+ % }
+ </div>
+ % }
</div>
% }
% else {
<div class="card">
<div class="card-content">
<i class="material-icons small right sync-failed-marker grey-text" style="display: none;">sync_problem</i>
- <span class="card-title"><%= $name %> ist gerade nicht eingecheckt</span>
+ % if (stash('from_profile')) {
+ <span class="card-title">Aktuell nicht eingecheckt</span>
+ % }
+ % else {
+ <span class="card-title"><a href="/p/<%= $name %>"><%= $name %></a> ist gerade nicht eingecheckt</span>
+ % }
<p>
- % if ($journey->{arr_name}) {
- Zuletzt gesehen
- % if ($journey->{real_arrival}->epoch and ($public_level & 0x20 or ($public_level & 0x10 and is_user_authenticated()))) {
- %= $journey->{real_arrival}->strftime('am %d.%m.%Y')
- in <b><%= $journey->{arr_name} %></b>
- %= $journey->{real_arrival}->strftime('(Ankunft um %H:%M Uhr)')
- % }
- % else {
- in <b><%= $journey->{arr_name} %></b>
- % }
+ % if ($journey->{arr_name}) {
+ Zuletzt gesehen
+ % if ($journey->{real_arrival}->epoch) {
+ %= $journey->{real_arrival}->strftime('am %d.%m.%Y')
+ in <b><%= $journey->{arr_name} %></b>
+ %= $journey->{real_arrival}->strftime('(Ankunft um %H:%M Uhr)')
% }
% else {
- Noch keine Zugfahrten geloggt.
+ in <b><%= $journey->{arr_name} %></b>
% }
+ % }
</p>
</div>
</div>