travelynx/templates/_connections_hafas.html.ep
Birte Kristina Friesel 7bf99b00a5
Use $train->type rather than firts part of $train->line for CSS class
In some cases (e.g. in Belgium), trains do not have a type, so the first part
of $train->line is the train number instead.
2023-10-27 18:34:02 +02:00

48 lines
1.3 KiB
Text

<ul class="collection departures connections">
% for my $res (@{$connections}) {
% my ($train, $via, $via_arr) = @{$res};
% $via_arr = $via_arr ? $via_arr->strftime('%H:%M') : q{};
% my $row_class = '';
% my $link_class = 'action-checkin';
% if ($train->is_cancelled) {
% $row_class = 'cancelled';
% $link_class = 'action-cancelled-from';
% }
% if ($checkin_from) {
<li class="collection-item <%= $row_class %> <%= $link_class %>"
data-station="<%= $train->station_eva %>"
data-train="<%= $train->id %>"
data-ts="<%= ($train->sched_datetime // $train->datetime)->epoch %>"
data-dest="<%= $via->{name} %>">
% }
% else {
<li class="collection-item">
% }
<a class="dep-time" href="#">
% if ($train->is_cancelled) {
%= $train->sched_datetime->strftime('%H:%M')
% }
% else {
%= $train->datetime->strftime('%H:%M')
% }
% if ($via_arr) {
→ <%= $via_arr %>
% }
% if ($train->delay) {
%= sprintf('(%+d)', $train->delay)
% }
</a>
<span class="connect-platform-wrapper">
% if ($train->platform) {
<span>Gleis <%= $train->platform %></span>
% }
<span class="dep-line <%= $train->type // q{} %>">
%= $train->line
</span>
</span>
<span class="dep-dest">
%= $via->{name}
</span>
</li>
% }
</ul>