summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-05-19 11:26:22 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-05-19 11:26:22 +0200
commit596f6deb1adef4200ddb3df4f02e6e98525a33a6 (patch)
tree51d1867ff00857feb5b9511d777b6c97b63bca4f
parentec5737ed4121ebd23c2a8667822fe557109f9b86 (diff)
show wagon order even if exact positions on platform are unknown2.0.4
-rw-r--r--lib/DBInfoscreen/Controller/Wagenreihung.pm11
-rw-r--r--templates/wagenreihung.html.ep16
2 files changed, 21 insertions, 6 deletions
diff --git a/lib/DBInfoscreen/Controller/Wagenreihung.pm b/lib/DBInfoscreen/Controller/Wagenreihung.pm
index 2279da3..986019b 100644
--- a/lib/DBInfoscreen/Controller/Wagenreihung.pm
+++ b/lib/DBInfoscreen/Controller/Wagenreihung.pm
@@ -16,6 +16,17 @@ sub wagenreihung {
train_number => $train,
);
+ if ( $wr->has_bad_wagons ) {
+
+ # create fake positions as the correct ones are not available
+ my $pos = 0;
+ for my $wagon ( $wr->wagons ) {
+ $wagon->{position}{start_percent} = $pos;
+ $wagon->{position}{end_percent} = $pos + 4;
+ $pos += 4;
+ }
+ }
+
$self->render(
'wagenreihung',
wr => $wr,
diff --git a/templates/wagenreihung.html.ep b/templates/wagenreihung.html.ep
index 0f38789..fc00968 100644
--- a/templates/wagenreihung.html.ep
+++ b/templates/wagenreihung.html.ep
@@ -32,11 +32,13 @@
% }
<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>
+% if (not $wr->has_bad_wagons) {
+% 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>
+% }
% }
% for my $wagon ($wr->wagons) {
% my $bg = '';
@@ -48,7 +50,9 @@
% }
<div style="position: absolute; left: 6em;
top: <%= $wagon->{position}{start_percent} %>%; bottom: <%= 100 - $wagon->{position}{end_percent} %>%;">
-% if ($wr->direction == 100) {
+% if ($wr->has_bad_wagons) {
+% }
+% elsif ($wr->direction == 100) {
% }
% else {