diff options
author | Daniel Friesel <derf@finalrewind.org> | 2023-02-12 12:42:55 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2023-02-12 12:42:55 +0100 |
commit | c65c85f3e23f3d4f5cc3f1faf70b6fb6e9578baa (patch) | |
tree | dbcdf3428f9a157b98053e2becd3e7893dce6843 | |
parent | 80c9068e98d2c10f116dd52f9d51ff892936dae5 (diff) |
add bahn.expert link to train details page
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 3 | ||||
-rw-r--r-- | public/static/icons/bahn-expert.svg | 5 | ||||
-rw-r--r-- | sass/app.scss | 7 | ||||
-rw-r--r-- | templates/_train_details.html.ep | 3 |
4 files changed, 18 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index a81c7d5..05d4afb 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1038,6 +1038,8 @@ sub station_train_details { wr_link => $result->sched_departure ? $result->sched_departure->strftime('%Y%m%d%H%M') : undef, + eva => $result->station_uic, + start => $result->start, }; $self->stash( title => $status->station->{name} @@ -1174,6 +1176,7 @@ sub train_details { ); } my $station_info = shift( @{ $res->{route_post_diff} } ); + $res->{eva} = $station_info->{eva}; if ( $station_info->{sched_arr} ) { $res->{sched_arrival} = $station_info->{sched_arr}->strftime('%H:%M'); diff --git a/public/static/icons/bahn-expert.svg b/public/static/icons/bahn-expert.svg new file mode 100644 index 0000000..4cee072 --- /dev/null +++ b/public/static/icons/bahn-expert.svg @@ -0,0 +1,5 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="910.683" height="911.613" viewBox="0 0 240.952 241.198"> + <path + d="M156.283 14.31l-76.155.03a6.102 6.102 0 0 0-.247 12.197c7.448.304 14.872 2.649 21.144 6.675 3.91 2.511 7.182 5.608 9.07 9.101.5.927.916 1.91 1.243 2.925-8.798.583-18.387 1.932-27.009 3.806-5.011 1.088-10.013 2.373-14.69 4.477-4.679 2.103-9.011 5.062-12.391 8.92-3.38 3.858-5.735 8.575-6.962 13.555-1.228 4.98-1.322 10.16-1.322 15.29v72.291c0 4.87.066 9.793 1.25 14.517 1.183 4.724 3.513 9.198 6.957 12.642 3.444 3.444 7.918 5.774 12.642 6.957 3.2.802 6.492 1.086 9.797 1.19l-21.18 31.596h16.19l8.39-12.515 75.786.067 8.284 12.355h16.189l-21.134-31.528c3.038-.124 6.059-.427 9.003-1.164 4.724-1.184 9.199-3.514 12.642-6.957 3.444-3.444 5.774-7.918 6.958-12.642 1.183-4.724 1.25-9.647 1.25-14.517V91.286c0-5.117-.096-10.285-1.328-15.25-1.232-4.967-3.594-9.668-6.98-13.504-3.385-3.837-7.72-6.77-12.393-8.853-4.674-2.083-9.666-3.351-14.665-4.44-9.599-2.092-18.512-3.595-28.316-4.119a20.03 20.03 0 0 1 1.782-3.754c1.785-2.919 4.444-5.549 7.575-7.78a39.466 39.466 0 0 1 19.172-7.098 6.102 6.102 0 0 0 5.522-6.351c-.148-3.25-2.82-5.797-6.074-5.826zm-29.096 12.215c-2.77 2.395-5.38 5.062-7.415 8.356-2.037-3.255-4.554-6.019-7.34-8.35zm-20.641 47.72c8.312 0 14.465 1.246 18.458 3.74 7.254-2.494 13.895-3.74 19.926-3.74 8.639 0 15.118 1.473 19.437 4.42 4.32 2.946 6.479 8.197 6.479 15.751v39.324h-22.249V99.403c0-2.947-.855-5.062-2.567-6.346-1.71-1.36-4.237-2.04-7.579-2.04-1.467 0-2.77.188-3.912.566-1.14.378-1.833.794-2.078 1.247v40.91h-22.248V99.403c0-2.947-.856-5.062-2.567-6.346-1.712-1.36-4.238-2.04-7.58-2.04-1.466 0-2.77.188-3.911.566-1.141.378-1.834.794-2.078 1.247v40.91H71.829V81.044c2.852-1.435 8.027-2.908 15.524-4.42 7.498-1.586 13.896-2.379 19.193-2.379zM83.483 152.82c7.27 0 13.165 5.895 13.165 13.166 0 7.27-5.894 13.165-13.165 13.165-7.271 0-13.166-5.894-13.166-13.165 0-7.271 5.895-13.166 13.166-13.166zm74.655 0c7.272 0 13.166 5.895 13.166 13.166 0 7.27-5.895 13.165-13.166 13.165-7.27 0-13.165-5.894-13.165-13.165 0-7.271 5.894-13.166 13.165-13.166zm-62.375 46.122H146l5.975 8.913-62.15-.054z" + fill="#FFF" /> +</svg> diff --git a/sass/app.scss b/sass/app.scss index 62b2cbd..9b37ece 100644 --- a/sass/app.scss +++ b/sass/app.scss @@ -821,6 +821,13 @@ div.field { margin-right: 0.5ex; } +.smallbutton img { + display: block; + float: left; + margin-right: 0.7ex; + height: 1.2em; +} + input, select, .button { display: inline-block; width: 60em; diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep index 82f0257..f212525 100644 --- a/templates/_train_details.html.ep +++ b/templates/_train_details.html.ep @@ -144,6 +144,9 @@ % elsif ($icetype and $icetype->[1] and $linetype eq 'fern') { <span class="disabledbutton"><i class="material-icons" aria-hidden="true">train</i> Plan: <%= $icetype->[0] %></span> % } +% if ($departure->{train_type} and $departure->{train_no}) { + <a class="smallbutton" href="https://bahn.expert/details/<%= $departure->{train_type} %>%20<%= $departure->{train_no} %>/<%= ($departure->{start} // DateTime->now(time_zone => 'Europe/Berlin'))->iso8601 %>?evaNumberAlongRoute=<%= $departure->{eva} %>"><img src="/static/icons/bahn-expert.svg">Details</a> +% } % for my $link (@{$departure->{links}}) { <a class="smallbutton" href="<%= $link->[1] %>"><i class="material-icons" aria-hidden="true">warning</i> <%= $link->[0] %></a> % } |