diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-04-06 21:51:16 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-04-06 21:51:16 +0200 |
commit | 3aeaacdf28285b8d8294370a1eb6c3ab21f7dc56 (patch) | |
tree | c9713d6c19cddc8f8ece6ecd6a3d92da504d876c /templates | |
parent | 9792369c2b79e68cc7384bbd9b55eef30fe8c004 (diff) |
wagenreihung: Check for backend error
Diffstat (limited to 'templates')
-rw-r--r-- | templates/wagenreihung.html.ep | 194 |
1 files changed, 102 insertions, 92 deletions
diff --git a/templates/wagenreihung.html.ep b/templates/wagenreihung.html.ep index 393adbf..8d0cb23 100644 --- a/templates/wagenreihung.html.ep +++ b/templates/wagenreihung.html.ep @@ -1,106 +1,116 @@ -<div class="container"> - <div style="text-align: center;"> -%= join(' / ', map { $wr->train_type . ' ' . $_ } $wr->train_numbers ) - </div> - <div style="text-align: center;"> -%= join( ' / ', $wr->origins ) - → -%= join( ' / ', $wr->destinations ) - </div> - <%= $wr->station_name %> Gleis <%= $wr->platform %><br/> - Zugtyp: <%= $wr->train_subtype // 'IC?' %> -</div> -</div> -% if ($wr->train_type ne 'ICE') { +% if ($wr->errstr) { <div class="container"> - <div class="warning"> - <strong>⚠ Keine zuverlässigen Daten vorhanden.</strong> - IC/EC-Wagenreihungen werden vom Backend noch nicht offiziell unterstützt. - Sowohl die hier angegebenen Daten als auch die am Bahnsteig angezeigte - Wagenreihung können fehlerhaft sein. + <div class="error"> + <strong>Fehler bei der Abfrage der Wagenreihung:</strong> + <%= $wr->errstr %> </div> </div> % } -<div class="container"> - <div style="position: relative; width: 100%; height: 60ex;"> -% for my $section ($wr->sections) { - <div style="position: absolute; left: 1em; width: 2em; - top: <%= $section->{start_percent} %>%; bottom: <%= 100 - $section->{end_percent} %>%; text-align: center;"> -%= $section->{name} +% else { + <div class="container"> + <div style="text-align: center;"> +%= join(' / ', map { $wr->train_type . ' ' . $_ } $wr->train_numbers ) + </div> + <div style="text-align: center;"> +%= join( ' / ', $wr->origins ) + → +%= join( ' / ', $wr->destinations ) + </div> + <%= $wr->station_name %> Gleis <%= $wr->platform %><br/> + Zugtyp: <%= $wr->train_subtype // 'IC?' %> + </div> + </div> +% if ($wr->train_type ne 'ICE') { + <div class="container"> + <div class="warning"> + <strong>⚠ Keine zuverlässigen Daten vorhanden.</strong> + IC/EC-Wagenreihungen werden vom Backend noch nicht offiziell unterstützt. + Sowohl die hier angegebenen Daten als auch die am Bahnsteig angezeigte + Wagenreihung können fehlerhaft sein. </div> + </div> % } -% for my $wagon ($wr->wagons) { -% my $bg = ''; -% if ($wagon->is_first_class) { -% $bg = 'background-color: #ffff99;'; -% } -% if ($wagon->is_locomotive or $wagon->is_powercar) { -% $bg = 'background-color: #cccccc;'; + <div class="container"> + <div style="position: relative; width: 100%; height: 60ex;"> +% for my $section ($wr->sections) { + <div style="position: absolute; left: 1em; width: 2em; + top: <%= $section->{start_percent} %>%; bottom: <%= 100 - $section->{end_percent} %>%; text-align: center;"> +%= $section->{name} + </div> % } - <div style="position: absolute; left: 6em; - top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%;"> -% if ($wr->direction == 100) { - ↓ -% } -% else { - ↑ -% } - </div> - <div style="position: absolute; left: 3em; - top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%; - min-width: 2em; text-align: right; - border: 1px solid black; padding-left: 0.2em; padding-right: 0.2em; <%= $bg %>"> -% if ($wagon->is_locomotive or $wagon->is_powercar) { - LOK -% } -% else { -%= $wagon->number // '?' -% } - </div> - <div style="position: absolute; left: 7em; right: 0em; - top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%;"> +% for my $wagon ($wr->wagons) { +% my $bg = ''; % if ($wagon->is_first_class) { - <span style="display: inline-block; width: 0.8em; text-align: center; color: #ffffff; background-color: #666666; border: 1px solid #666666;">1</span> -% } -% if ($wagon->is_second_class) { - <span style="display: inline-block; width: 0.8em; text-align: center; color: #666666; border: 1px solid #666666;">2</span> +% $bg = 'background-color: #ffff99;'; % } -% if ($wagon->has_accessibility) { - ♿ -% } -% if ($wagon->has_bistro) { - 🍴 -% } -% if ($wagon->has_compartments) { - 🚪 -% } -% if ($wagon->has_quiet_area) { - 🔇 -% } -% if ($wagon->has_phone_area) { - 📱 -% } -% if ($wagon->has_family_area) { - 👪 -% } -% if ($wagon->has_bahn_comfort) { - bahn.comfort -% } -% if ($wagon->is_interregio) { - Interregio +% if ($wagon->is_locomotive or $wagon->is_powercar) { +% $bg = 'background-color: #cccccc;'; % } - <span style="color: #999999;"> -%= $wagon->type - </span> + <div style="position: absolute; left: 6em; + top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%;"> +% if ($wr->direction == 100) { + ↓ +% } +% else { + ↑ +% } + </div> + <div style="position: absolute; left: 3em; + top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%; + min-width: 2em; text-align: right; + border: 1px solid black; padding-left: 0.2em; padding-right: 0.2em; <%= $bg %>"> +% if ($wagon->is_locomotive or $wagon->is_powercar) { + LOK +% } +% else { +%= $wagon->number // '?' +% } + </div> + <div style="position: absolute; left: 7em; right: 0em; + top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%;"> +% if ($wagon->is_first_class) { + <span style="display: inline-block; width: 0.8em; text-align: center; color: #ffffff; background-color: #666666; border: 1px solid #666666;">1</span> +% } +% if ($wagon->is_second_class) { + <span style="display: inline-block; width: 0.8em; text-align: center; color: #666666; border: 1px solid #666666;">2</span> +% } +% if ($wagon->has_accessibility) { + ♿ +% } +% if ($wagon->has_bistro) { + 🍴 +% } +% if ($wagon->has_compartments) { + 🚪 +% } +% if ($wagon->has_quiet_area) { + 🔇 +% } +% if ($wagon->has_phone_area) { + 📱 +% } +% if ($wagon->has_family_area) { + 👪 +% } +% if ($wagon->has_bahn_comfort) { + bahn.comfort +% } +% if ($wagon->is_interregio) { + Interregio +% } + <span style="color: #999999;"> +%= $wagon->type + </span> + </div> +% } </div> -% } - </div> <!-- <div> - Legende: ♿ Behindertengerechte Ausstattung / 🍴 Bistro/Restaurant / 🚪 Abteile vorhanden - </div> + Legende: ♿ Behindertengerechte Ausstattung / 🍴 Bistro/Restaurant / 🚪 Abteile vorhanden + </div> --> - <div> - Angaben ohne Gewähr – Echtzeitdaten sind möglicherweise nicht berücksichtigt. - </div> + <div> + Angaben ohne Gewähr – Echtzeitdaten sind möglicherweise nicht berücksichtigt. + </div> -</div> + </div> +% } |