Skip to content

Commit

Permalink
Make "Zuglauf" links work for non-DB checkins
Browse files Browse the repository at this point in the history
replaces text with "Details" for those
  • Loading branch information
derf committed Feb 9, 2025
1 parent 5c52881 commit 5d3cf2c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
18 changes: 7 additions & 11 deletions templates/_checked_in.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -356,24 +356,20 @@
% }
</div>
<div class="card-action">
% my $url = 'https://bahn.expert/details/';
% if ($journey->{train_id} =~ m{[|]}) {
% if ($journey->{train_type} and $journey->{train_no}) {
% $url .= $journey->{train_type} . ' ' . $journey->{train_no};
% }
% $url .= '/' . $journey->{sched_departure}->epoch . '000?jid=' . $journey->{train_id} =~ s{#}{%23}gr;
% }
% else {
% $url .= $journey->{train_type} . ' ' . $journey->{train_no} . '/' . $journey->{sched_departure}->epoch . '000?station=' . $journey->{dep_eva};
% my $url = 'https://dbf.finalrewind.org/z/';
% if ($journey->{is_hafas}) {
% $url .= $journey->{train_id} =~ s{#}{%23}gr . '?hafas=' . $journey->{backend_name};
<a style="margin-right: 0;" href="<%= $url %>"><i class="material-icons left" aria-hidden="true">timeline</i> Details</a>
% }
% if ($journey->{backend_id} <= 1) {
% elsif ($journey->{extra_data}{trip_id}) {
% $url .= $journey->{extra_data}{trip_id} =~ s{#}{%23}gr;
<a style="margin-right: 0;" href="<%= $url %>"><i class="material-icons left" aria-hidden="true">timeline</i> Zuglauf</a>
% }
% else {
&nbsp;
% }
% if ($journey->{extra_data}{trip_id}) {
<a class="right" style="margin-right: 0;" href="https://dbf.finalrewind.org/map/<%= $journey->{extra_data}{trip_id} =~ s{#}{%23}gr %>/<%= $journey->{train_line} || 0 %>?hafas=<%= $journey->{backend_name} // 'DB' %>&amp;from=<%= $journey->{dep_name} %>&amp;to=<%= $journey->{arr_name} %>&amp;dark=<%= (session('theme') and session('theme') eq 'dark') ? 1 : 0 %>"><i class="material-icons left" aria-hidden="true">map</i> Karte</a>
<a class="right" style="margin-right: 0;" href="https://dbf.finalrewind.org/map/<%= $journey->{extra_data}{trip_id} =~ s{#}{%23}gr %>/<%= $journey->{train_line} || 0 %>?hafas=<%= $journey->{backend_name} // 'VRN' %>&amp;from=<%= $journey->{dep_name} %>&amp;to=<%= $journey->{arr_name} %>"><i class="material-icons left" aria-hidden="true">map</i> Karte</a>
% }
</div>
</div>
Expand Down
9 changes: 7 additions & 2 deletions templates/_public_status_card.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,13 @@
<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>
% } elsif ($journey->{backend_id} <= 1) {
% my $url = 'https://bahn.expert/details/' . $journey->{train_type} . ' ' . $journey->{train_no} . '/' . DateTime->now(time_zone => 'Europe/Berlin')->epoch . '000';
% }
% elsif ($journey->{is_hafas}) {
% my $url = 'https://dbf.finalrewind.org/z/' . $journey->{train_id} =~ s{#}{%23}gr . '?hafas=' . $journey->{backend_name};
<a style="margin-right: 0;" href="<%= $url %>"><i class="material-icons left">timeline</i> Details</a>
% }
% elsif ($journey->{extra_data}{trip_id}) {
% my $url = 'https://dbf.finalrewind.org/z/' . $journey->{extra_data}{trip_id} =~ s{#}{%23}gr;
<a style="margin-right: 0;" href="<%= $url %>"><i class="material-icons left">timeline</i> Zuglauf</a>
% }
% else {
Expand Down

0 comments on commit 5d3cf2c

Please sign in to comment.