From f0d831ebbb2d45b10b64f2456643d81b9af1ae06 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Mon, 29 Apr 2024 19:10:40 +0200 Subject: replace DBWagenreihung group_index hack with new group accessor --- templates/_wagon.html.ep | 6 +++--- templates/wagenreihung.html.ep | 28 +++++++++++----------------- 2 files changed, 14 insertions(+), 20 deletions(-) (limited to 'templates') diff --git a/templates/_wagon.html.ep b/templates/_wagon.html.ep index c19087c..59a2ca1 100644 --- a/templates/_wagon.html.ep +++ b/templates/_wagon.html.ep @@ -86,7 +86,7 @@ % } % } -% if ($multi and defined $wagon->group_index and (not defined $prev_gi or $wagon->group_index != $prev_gi)) { +% if ($multi and $first) {
% if (scalar $wr->train_nos > 1) { @@ -96,8 +96,8 @@ → <%= $wr->{data}{istformation}{allFahrzeuggruppe}[$wagon->group_index]{zielbetriebsstellename} %> % } - % if (scalar $wr->train_descriptions > 1 and ($wr->train_descriptions)[$wagon->group_index]{short}) { - <%= ($wr->train_descriptions)[$wagon->group_index]{short} %> + % if ($multi and ($wr->groups)[$wagon->group_index]->desc_short) { + <%= ($wr->groups)[$wagon->group_index]->desc_short %> % } % } diff --git a/templates/wagenreihung.html.ep b/templates/wagenreihung.html.ep index cd4d611..6781dca 100644 --- a/templates/wagenreihung.html.ep +++ b/templates/wagenreihung.html.ep @@ -7,14 +7,6 @@ % } % 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; - % }
<%= $wr->station->{name} %> Gleis <%= $wr->platform %>
@@ -30,10 +22,12 @@
% } % } -% my $gi; -% for my $wagon ($wr->wagons) { -%= include '_wagon', wr => $wr, wagon => $wagon, prev_gi => $gi, multi => $has_multi_desc + (scalar $wr->destinations) - 1 + (scalar $wr->train_nos) - 1, wref => $wref, exit_dir => stash('exit_dir'); -% $gi = $wagon->group_index; +% 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'); +% $first = 0; +% } % }
@@ -41,12 +35,12 @@ → %= join( ' / ', map { $_->{name} } $wr->destinations )
- % for my $desc ($wr->train_descriptions) { - % if ($desc->{text}) { + % for my $group ($wr->groups) { + % if ($group->description) {
- %= $desc->{text} - % if ($has_multi_desc and length(join(q{}, sort @{$desc->{sections}}))) { - in Abschnitt <%= join(q{}, sort @{$desc->{sections}}) %> + %= $group->description + % if (scalar $wr->groups > 1 and $group->has_sections) { + in Abschnitt <%= join(q{}, sort $group->sections) %> % }
% } -- cgit v1.2.3