summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-01-10 12:22:47 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-01-10 12:22:47 +0100
commitf3694fdc35b817138a97a42e39eb6a2619591736 (patch)
tree333a56dc3a9b28464e4f98307329a1faa894bfb8 /templates
parent789d604c1a83a1063b4c0f86f1853b3753c7327d (diff)
fix wagon images for trains consisting of different sub-types
E.g. ICE T 411 + ICE T 415 or ICE 3 403.1 + ICE 3 403 Redesign
Diffstat (limited to 'templates')
-rw-r--r--templates/_wagon.html.ep4
-rw-r--r--templates/wagenreihung.html.ep36
2 files changed, 15 insertions, 25 deletions
diff --git a/templates/_wagon.html.ep b/templates/_wagon.html.ep
index 7a2a9a3..6c02827 100644
--- a/templates/_wagon.html.ep
+++ b/templates/_wagon.html.ep
@@ -51,7 +51,7 @@
<div class="details" style="
top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%;">
% if ($exit_dir ne 'right') {
-% if (my $img = wagon_image($type, $wagon->type, $wagon->uic_id)) {
+% if (my $img = wagon_image($wagon->train_subtype // 'IC', $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 {
@@ -71,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($type, $wagon->type, $wagon->uic_id)) {
+% if (my $img = wagon_image($wagon->train_subtype // 'IC', $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 {
diff --git a/templates/wagenreihung.html.ep b/templates/wagenreihung.html.ep
index 4d83d2b..0686063 100644
--- a/templates/wagenreihung.html.ep
+++ b/templates/wagenreihung.html.ep
@@ -8,9 +8,13 @@
% }
% else {
% my $has_multi_dest = 0;
+ % my $has_multi_desc = 0;
% if (scalar $wr->destinations > 1) {
% $has_multi_dest = 1;
% }
+ % if (scalar $wr->train_descriptions > 1) {
+ % $has_multi_desc = 1;
+ % }
<div class="container">
<div style="text-align: center;">
%= join( ' / ', $wr->origins )
@@ -25,29 +29,15 @@
</div>
% }
<%= $wr->station_name %> Gleis <%= $wr->platform %><br/>
- % if ($wr->train_type =~ m{^IC|EC}) {
- Zugtyp: <%= $wr->train_subtype // 'IC?' %>
+ % for my $desc ($wr->train_descriptions) {
+ % if ($desc->{text}) {
+ %= $desc->{text}
+ % if ($has_multi_desc) {
+ in Abschnitt <%= join(q{}, sort @{$desc->{sections}}) %>
+ % }
+ <br/>
+ % }
% }
- % elsif ($wr->train_powertype) {
- %= $wr->train_type
- % }
- % my %translation = (
- % 90 => 'mit sonstigem Antrieb',
- % 91 => 'mit elektrischer Lokomotive',
- % 92 => 'mit Diesellokomotive',
- % 93 => 'Hochgeschwindigkeitszug',
- % 94 => 'Elektrischer Triebzug',
- % 95 => 'Diesel-Triebzug',
- % 96 => 'mit speziellen Beiwagen',
- % 97 => 'mit elektrischer Rangierlok',
- % 98 => 'mit Diesel-Rangierlok',
- % 99 => 'Sonderfahrzeug',
- % );
- % if (not $wr->train_powertype) {
- % }
- % else {
- %= $translation{$wr->train_powertype};
- % }
</div>
<div class="container">
<div class="wagonorder exit-<%= stash('exit_dir') // 'unknown'%>">
@@ -60,7 +50,7 @@
% }
% }
% for my $wagon ($wr->wagons) {
-%= include '_wagon', direction => $wr->direction, wagon => $wagon, type => $wr->train_subtype // 'IC', wref => $wref, exit_dir => stash('exit_dir');
+%= include '_wagon', direction => $wr->direction, wagon => $wagon, wref => $wref, exit_dir => stash('exit_dir');
% }
</div>
<!-- <div>