From 3c85cd22395be60462959ee7d3cf59d0e939b6a3 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 14 Dec 2020 18:23:23 +0100 Subject: wagonorder: move wagon display to a separate template --- templates/_wagon.html.ep | 66 +++++++++++++++++++++++++++++++++++++++++ templates/wagenreihung.html.ep | 67 +----------------------------------------- 2 files changed, 67 insertions(+), 66 deletions(-) create mode 100644 templates/_wagon.html.ep diff --git a/templates/_wagon.html.ep b/templates/_wagon.html.ep new file mode 100644 index 0000000..95b1c2e --- /dev/null +++ b/templates/_wagon.html.ep @@ -0,0 +1,66 @@ +% my $bg = ''; +% my $extra_class = ''; +% if ($wagon->is_first_class) { +% $extra_class .= ' firstclass'; +% } +% if ($wagon->is_locomotive or $wagon->is_powercar) { +% $extra_class .= ' powercar'; +% } +% if ($wagon->train_no ne $train_no) { +% $extra_class .= ' nondestwagon'; +% } +
+% if ($wagon->is_locomotive or $wagon->is_powercar) { +% } +% else { +%= $wagon->number // '?' +% if ($wagon->has_accessibility) { + accessible +% } +% if ($wagon->has_bistro) { + restaurant +% } +% if ($wagon->has_compartments) { + +% } +% if ($wagon->has_quiet_area) { + volume_off +% } +% if ($wagon->has_phone_area) { + smartphone +% } +% if ($wagon->has_family_area) { + people +% } +% if ($wagon->has_bahn_comfort) { + star +% } +% } +
+% if (not defined $direction) { +% } +% elsif ($direction == 100) { + arrow_downward +% } +% else { + arrow_upward +% } +
+
+
+ +%= $wagon->type + +% my $uic_id = $wagon->uic_id; +% if (length($uic_id) != 12) { + <%= $uic_id %> +% } +% elsif (substr($uic_id, 0, 2) >= 90) { + <%= substr($uic_id, 0, 2) %><%= substr($uic_id, 2, 2) %><%= substr($uic_id, 4, 1) %><%= substr($uic_id, 5, 3) %><%= substr($uic_id, 8, 3) %><%= substr($uic_id, 11) %> +% } +% else { + <%= substr($uic_id, 0, 2) %><%= substr($uic_id, 2, 2) %><%= substr($uic_id, 4, 2) %><%= substr($uic_id, 6, 2) %><%= substr($uic_id, 8, 3) %><%= substr($uic_id, 11) %> +% } +
diff --git a/templates/wagenreihung.html.ep b/templates/wagenreihung.html.ep index 1ef0370..98e4890 100644 --- a/templates/wagenreihung.html.ep +++ b/templates/wagenreihung.html.ep @@ -61,72 +61,7 @@ % } % } % for my $wagon ($wr->wagons) { -% my $bg = ''; -% my $extra_class = ''; -% if ($wagon->is_first_class) { -% $extra_class .= ' firstclass'; -% } -% if ($wagon->is_locomotive or $wagon->is_powercar) { -% $extra_class .= ' powercar'; -% } -% if ($wagon->train_no ne $train_no) { -% $extra_class .= ' nondestwagon'; -% } -
-% if ($wagon->is_locomotive or $wagon->is_powercar) { -% } -% else { -%= $wagon->number // '?' -% if ($wagon->has_accessibility) { - accessible -% } -% if ($wagon->has_bistro) { - restaurant -% } -% if ($wagon->has_compartments) { - -% } -% if ($wagon->has_quiet_area) { - volume_off -% } -% if ($wagon->has_phone_area) { - smartphone -% } -% if ($wagon->has_family_area) { - people -% } -% if ($wagon->has_bahn_comfort) { - star -% } -% } -
-% if ($wr->has_bad_wagons or not defined $wr->direction) { -% } -% elsif ($wr->direction == 100) { - arrow_downward -% } -% else { - arrow_upward -% } -
-
-
- -%= $wagon->type - -% my $uic_id = $wagon->uic_id; -% if (length($uic_id) != 12) { - <%= $uic_id %> -% } -% elsif (substr($uic_id, 0, 2) >= 90) { - <%= substr($uic_id, 0, 2) %><%= substr($uic_id, 2, 2) %><%= substr($uic_id, 4, 1) %><%= substr($uic_id, 5, 3) %><%= substr($uic_id, 8, 3) %><%= substr($uic_id, 11) %> -% } -% else { - <%= substr($uic_id, 0, 2) %><%= substr($uic_id, 2, 2) %><%= substr($uic_id, 4, 2) %><%= substr($uic_id, 6, 2) %><%= substr($uic_id, 8, 3) %><%= substr($uic_id, 11) %> -% } -
+%= include '_wagon', direction => $wr->direction, wagon => $wagon; % }