summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-07-30 15:14:24 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-07-30 15:14:24 +0200
commitc74b91b09f8888b5d4a35b7b2cb49d313db342d9 (patch)
tree7df5071dcd31070150a7a869053ce027aab84d78 /templates
parent1db9406711673beee6bf76555851e73b447c44d8 (diff)
Switch to new bahn.de carriage formation API (WiP)
Diffstat (limited to 'templates')
-rw-r--r--templates/_train_details.html.ep4
-rw-r--r--templates/_wagon.html.ep44
-rw-r--r--templates/wagenreihung.html.ep31
3 files changed, 35 insertions, 44 deletions
diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep
index c0248d9..49edc3e 100644
--- a/templates/_train_details.html.ep
+++ b/templates/_train_details.html.ep
@@ -128,7 +128,7 @@
% $left = q{};
% $right = '▶';
% }
- <a href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>?e=<%= $departure->{wr_direction} // '' %>">
+ <a href="/carriage-formation?<%= $departure->{wr_link} %>&amp;e=<%= $departure->{wr_direction} // '' %>">
%= $left
% for my $entry ((defined $departure->{wr_direction_num} and $departure->{wr_direction_num} != $wr->direction) ? reverse @{$departure->{wr_preview} // []} : @{$departure->{wr_preview} // []}) {
% if ($entry->[1]) {
@@ -152,7 +152,7 @@
% }
% }
% if ($departure->{wr_link}) {
- <a class="smallbutton" href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>?e=<%= $departure->{wr_direction} // '' %>"><i class="material-icons" aria-hidden="true">train</i> <%= $departure->{wr_text} || 'Wagen' %>
+ <a class="smallbutton" href="/carriage-formation?<%= $departure->{wr_link} %>&amp;e=<%= $departure->{wr_direction} // '' %>"><i class="material-icons" aria-hidden="true">train</i> <%= $departure->{wr_text} || 'Wagen' %>
</a>
% }
% if ($departure->{train_type} and $departure->{train_no} and (not param('hafas') or param('hafas') eq 'DB')) {
diff --git a/templates/_wagon.html.ep b/templates/_wagon.html.ep
index 59a2ca1..46d07b7 100644
--- a/templates/_wagon.html.ep
+++ b/templates/_wagon.html.ep
@@ -1,19 +1,19 @@
% my $bg = '';
% my $extra_class = '';
-% if ($wagon->is_first_class) {
-% $extra_class .= ' firstclass';
-% }
+% #if ($wagon->has_first_class) {
+% # $extra_class .= ' firstclass';
+% #}
% if ($wagon->is_locomotive or $wagon->is_powercar) {
% $extra_class .= ' powercar';
% }
% if ($wagon->is_closed) {
% $extra_class .= ' closed';
% }
-% if ($wagon->train_no ne $train_no) {
+% if ($group->train_no ne $train_no) {
% $extra_class .= ' nondestwagon';
% }
<div class="wagon <%= $extra_class %>" style="
- top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%; <%= $bg %>">
+ top: <%= $wagon->start_percent %>%; bottom: <%= 100 - $wagon->end_percent %>%; <%= $bg %>">
% if ($wagon->is_locomotive or $wagon->is_powercar) {
% }
% elsif ($wagon->is_closed) {
@@ -21,25 +21,19 @@
% }
% else {
%= $wagon->number // '?'
-% if ($wagon->has_accessibility) {
+% if(0){ #if ($wagon->has_wheelchair_space) {
<i class="material-icons" style="font-size: 20px;">accessible</i>
% }
-% if ($wagon->has_bistro) {
+% if(0){ #if ($wagon->has_bistro) {
<i class="material-icons">restaurant</i>
% }
-% if ($wagon->has_compartments) {
- <!--<i class="material-icons">folder</i>-->
-% }
-% if ($wagon->has_quiet_area) {
+% if(0){ #if ($wagon->has_quiet_zone) {
<i class="tiny material-icons">volume_off</i>
% }
-% if ($wagon->has_phone_area) {
- <i class="material-icons">smartphone</i>
-% }
-% if ($wagon->has_family_area) {
+% if(0){ #if ($wagon->has_family_zone) {
<i class="material-icons">people</i>
% }
-% if ($wagon->has_bahn_comfort) {
+% if(0){ #if ($wagon->has_bahn_comfort) {
<i class="material-icons">star</i>
% }
% }
@@ -55,9 +49,9 @@
</div>
</div>
<div class="details" style="
- top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%;">
+ top: <%= $wagon->start_percent %>%; bottom: <%= 100 - $wagon->end_percent %>%;">
% if ($exit_dir ne 'right') {
-% if (my $img = wagon_image($wagon->train_subtype // $wr->train_type // '?', $wagon->type, $wagon->uic_id)) {
+% if (my $img = wagon_image($wr->train_type // '?', $wagon->type, $wagon->uic_id)) {
<a class="type" href="/w/<%= $img %>?n=<%= $wagon->number // '' %>&amp;s=<%= $wagon->section %>&amp;r=<%= $wref %>"><%= $wagon->type %></a>
% }
% else {
@@ -67,7 +61,7 @@
% }
% }
% my $uic_id = $wagon->uic_id;
-% if (length($uic_id) != 12) {
+% if (length($uic_id) != 12 and length($uic_id) != 14) {
<span class="uicunknown"><%= $uic_id %></span>
% }
% elsif (substr($uic_id, 0, 2) >= 90) {
@@ -77,7 +71,7 @@
<span class="uicexchange"><%= substr($uic_id, 0, 2) %></span><span class="uiccountry"><%= substr($uic_id, 2, 2) %></span><span class="uic56"><%= substr($uic_id, 4, 2) %></span><span class="uic78"><%= substr($uic_id, 6, 2) %></span><span class="uicno"><%= substr($uic_id, 8, 3) %></span><span class="uiccheck"><%= substr($uic_id, 11) %></span>
% }
% if ($exit_dir eq 'right') {
-% if (my $img = wagon_image($wagon->train_subtype // $wr->train_type // '?', $wagon->type, $wagon->uic_id)) {
+% if (my $img = wagon_image($wr->train_type // '?', $wagon->type, $wagon->uic_id)) {
<a class="type" href="/w/<%= $img %>?n=<%= $wagon->number // '' %>&amp;s=<%= $wagon->section %>&amp;r=<%= $wref %>"><%= $wagon->type %></a>
% }
% else {
@@ -89,15 +83,15 @@
% if ($multi and $first) {
<br/>
<span class="groupno">
-% if (scalar $wr->train_nos > 1) {
- <%= $wr->train_type %> <%= ($wr->groups)[$wagon->group_index]->train_no %>
+% if (scalar $wr->train_numbers > 1) {
+ <%= $group->train_type %> <%= $group->train_no %>
% }
% if (scalar $wr->destinations > 1) {
- → <%= $wr->{data}{istformation}{allFahrzeuggruppe}[$wagon->group_index]{zielbetriebsstellename} %>
+ → <%= $group->destination %>
% }
</span>
- % if ($multi and ($wr->groups)[$wagon->group_index]->desc_short) {
- <span class="grouptype"><%= ($wr->groups)[$wagon->group_index]->desc_short %></span>
+ % if ($multi and $group->desc_short) {
+ <span class="grouptype"><%= $group->desc_short %></span>
% }
% }
</div>
diff --git a/templates/wagenreihung.html.ep b/templates/wagenreihung.html.ep
index 6781dca..0af66bd 100644
--- a/templates/wagenreihung.html.ep
+++ b/templates/wagenreihung.html.ep
@@ -9,42 +9,39 @@
% else {
<div class="container">
<div style="text-align: center;">
- <%= $wr->station->{name} %> Gleis <%= $wr->platform %><br/>
+ Gleis <%= $wr->platform %><br/>
</div>
</div>
<div class="container">
<div class="wagonorder exit-<%= stash('exit_dir') // 'unknown'%>">
-% if (not $wr->has_bad_wagons) {
-% for my $section ($wr->sections) {
- <div class="section" style="
- top: <%= $section->{start_percent} %>%; bottom: <%= 100 - $section->{end_percent} %>%;">
-%= $section->{name}
- </div>
-% }
+% for my $sector ($wr->sectors) {
+ <div class="section" style="
+ top: <%= $sector->start_percent %>%; bottom: <%= 100 - $sector->end_percent %>%;">
+%= $sector->name
+ </div>
% }
% for my $group ($wr->groups) {
% my $first = 1;
-% for my $wagon ($group->wagons) {
-%= include '_wagon', wr => $wr, wagon => $wagon, first => $first, multi => (scalar $wr->destinations) - 1 + (scalar $wr->train_nos) - 1, wref => $wref, exit_dir => stash('exit_dir');
+% for my $wagon ($group->carriages) {
+%= include '_wagon', wr => $wr, group => $group, wagon => $wagon, first => $first, multi => (scalar $wr->destinations) - 1 + (scalar $wr->train_numbers) - 1, wref => $wref, exit_dir => stash('exit_dir'), train_no => param('number');
% $first = 0;
% }
% }
</div>
- <div style="text-align: center;">
-%= join( ' / ', map { $_->{name} } $wr->origins )
- →
-%= join( ' / ', map { $_->{name} } $wr->destinations )
- </div>
% for my $group ($wr->groups) {
% if ($group->description) {
<div style="text-align: center;">
%= $group->description
- % if (scalar $wr->groups > 1 and $group->has_sections) {
- in Abschnitt <%= join(q{}, sort $group->sections) %>
+ % if (scalar $wr->groups > 1 and $group->has_sectors) {
+ in Abschnitt <%= join(q{}, sort $group->sectors) %>
% }
</div>
% }
% }
+ <div style="text-align: center;">
+ nach
+%= join( ' / ', map { $_->{name} } $wr->destinations )
+ </div>
<!-- <div>
Legende: ♿ Behindertengerechte Ausstattung / 🍴 Bistro/Restaurant / 🚪 Abteile vorhanden
</div>